fakir/examples/rec.fk

13 lines
248 B
Plaintext
Raw Permalink Normal View History

2023-09-22 07:49:28 +00:00
;; RECURSIVE LAMBDA
;; ================
(assert= 720 ((-> (n)
(if (= n 0) 1
(* n (self (- n 1))))) 6))
;; RECURSIVE NAMED LAMBDA
;; ======================
($ fac (-> (n)
(if (= n 0) 1
(* n (fac (- n 1))))))
(assert= 120 (fac 5))