public
Description: a Scheme written in Ruby, but implemented on the bus!
Homepage: http://bus-scheme.rubyforge.org
Clone URL: git://github.com/technomancy/bus-scheme.git
bus-scheme / examples / blog.scm
100644 25 lines (21 sloc) 0.529 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
(define blog-posts ())
 
(define post
  (lambda (id title body timestamp tags)
    (define blog-posts (cons
      (defresource (+ "/"
          (number->string id))
       ;; Gah; i need quasiquote!
       (list 'html (list 'head
           (list p'title
             title))
        (list 'body
         (list 'div 'class "post"
           (list 'h1 title)
           body))))
      blog-posts))))
 
(defresource "/" (lambda (env)
     (map (lambda (post)
       (list 'div 'class "post"
        (list 'h1 (post 'title))
        (post 'body)))
      (resources-list))))