chibi-scheme/tests/basic/test00-fact-3.scm
Alex Shinn 44a6c530d9 EVAL save/restores the current exception handler.
It doesn't really make sense for an exception to pass
outside of EVAL.  Fixes issue #17.
2009-12-28 23:18:04 +09:00

14 lines
187 B
Scheme

(define (fact-helper x res)
(if (= x 0)
res
(fact-helper (- x 1) (* res x))))
(define (fact x)
(fact-helper x 1))
(display "(fact 3) => ")
(write (fact 3))
(newline)