post-scarcity/lisp/fact.lisp

8 lines
165 B
Common Lisp

(set! fact
(lambda (n)
"Compute the factorial of `n`, expected to be an integer."
(cond ((= n 1) 1)
(t (* n (fact (- n 1)))))))
(fact 21)