Previously, #; awaited an S-expression but could not cope with a simple datum like a number literal. While at it, also support R6RS brackets for S-expressions.
27 lines
373 B
Scheme
27 lines
373 B
Scheme
#!r6rs
|
|
|
|
#|
|
|
|
|
The FACT procedure computes the factorial
|
|
|
|
of a non-negative integer.
|
|
|
|
#| These comments can be nested too. |#
|
|
|
|
|#
|
|
|
|
(define fact
|
|
|
|
(lambda (n)
|
|
|
|
;; base case
|
|
|
|
(if (= n 0)
|
|
|
|
#;(= n 1)
|
|
#;(= n [1+ (eval '(n))])1
|
|
#;[= n (1+ [eval '[n]])];; another comment
|
|
#;1
|
|
; identity of *
|
|
|
|
(* n (fact (- n 1))))))
|