module Main where import Prelude hiding (map, span, head, div) import CGI {-- ms> -----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|----- ms> (define (fact n) ms> (if (= n 0) ms> 1 ms> (* n (fact (- n 1))))) ms> (define (make-fact-row n) ms> (tr (td :align 'center (bold n)) ms> (td :align 'right (it (fact n))))) ms> (define (make-fact-table n) ms> (apply table :border 1 ms> (tr (th "n=") (th "fact")) ms> (map make-fact-row (upto 3 n)))) ms> (font :size -1 (make-fact-table 11)) ms> -----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|----- -} fact n = if n == 0 then 1 else n * fact (n - 1) makeFactRow n =
n= | fact |
---|