13 lines
230 B
Text
13 lines
230 B
Text
;; The Y combinator:
|
|
(defun y (f)
|
|
[(op @1 @1)
|
|
(op f (op [@@1 @@1]))])
|
|
|
|
;; The Y-combinator-based factorial:
|
|
(defun fac (f)
|
|
(do if (zerop @1)
|
|
1
|
|
(* @1 [f (- @1 1)])))
|
|
|
|
;; Test:
|
|
(format t "~s\n" [[y fac] 4])
|