scsh-0.6/ps-compiler/prescheme/test/fact.scm

15 lines
249 B
Scheme
Raw Permalink Normal View History

1999-09-14 08:45:02 -04:00
; Copyright (c) 1994 by Richard Kelsey. See file COPYING.
(define *one* 1)
(define (fact n)
(let loop ((i n) (r *one*))
(if (<= *one* i)
(loop (- i *one*) (* i r))
r)))
(define (all)
(set! *one* (fact (if (> (fact 10) 100) 10 20))))