This commit is contained in:
2026-05-18 10:08:03 -06:00
parent 4ef6788029
commit afc68e2a55
32 changed files with 270 additions and 38 deletions
+16
View File
@@ -0,0 +1,16 @@
(define (factorial n)
(if (zero? n)
1
(* n (factorial (- n 1)))))
;;; ANF
(define (factorial n)
(let ((r (zero? n)))
(if r
1
(let ((r (- n 1))
(r (factorial r))
(r (* n r)))
r))))