Welcome to the CHICKEN Scheme pasting service

hyde.scm added by npgm on Sun Jan 11 19:58:30 2015

(use hyde hyde-atom hyde-page-eval-env lowdown regex srfi-19)

;; add markdown to html to translators
(translators (cons (list "md" markdown->html) (translators)))
(make-page-eval-env)

;; bring in some functions to this context
(define $ (environment-ref (page-eval-env) '$))
(define page-path (environment-ref (page-eval-env) 'page-path))
(define current-page (environment-ref (page-eval-env) 'current-page))

(define (post-updated page)
	($ 'date page))

(define (sort-by ppages accessor)
	(sort ppages (lambda (p1 p2) (> (accessor p1) (accessor p2)))))

(define (ppages-matching regex)
	(map cdr (filter (lambda (p) (string-match regex (car p)))
									 (pages))))

(define (all-posts) (sort-by (ppages-matching "posts/.+") post-updated))

(define (pretty-date d)
	(time->string (seconds->utc-time d) "%B %d, %Y"))

;; set up environment bindings
(for-each (lambda (binding)
						(apply environment-extend! (cons (page-eval-env) binding)))
					`((all-posts ,all-posts)
						(pretty-date ,pretty-date)))

Your annotation:

Enter a new annotation:

Your nick:
The title of your paste:
Your paste (mandatory) :
Which R5RS procedure returns `'(2 3)' when given `'(1 2 3)' as input?
Visually impaired? Let me spell it for you (wav file) download WAV