Back to slide -- Keyboard shortcut: 'u'              Slide 13 : 15
Program 1

(load (string-append laml-dir "laml.scm"))
(laml-style "simple-xhtml1.0-transitional-validating")
(set-xml-accept-extended-contents-in 'xhtml10-transitional #t)
(define map (curry-generalized map))

(define (factorial x)
  (if (< x 2)
      x 
      (* x (factorial (- x 1)))))

(write-html '(pp prolog)
 (html 
   (head 
     (title "Factorial"))
  (body 
    (table 'border "2"                               
     (caption "The first 20 factorial numbers")          
     (thead (tr (td "n") (td "fac(n)")))

     (map (compose tr (map td))
       (map (lambda (n) (list n (factorial n)))
            (number-interval 1 20))) 
    )
  )
 )
)

(end-laml)