post-scarcity/lisp/fact.lisp

8 lines
173 B
Common Lisp

(set! fact
(lambda (n)
"Compute the factorial of `n`, expected to be a natural number."
(cond ((= n 1) 1)
(t (* n (fact (- n 1)))))))
(fact 1000)