22 lines
565 B
Plaintext
22 lines
565 B
Plaintext
|
<> ((defun ?n ?p ?b)) (defun ?n ?p ?b)
|
||
|
<> (defun ?n ?p ?b) (<> (?n ?p) ?b)
|
||
|
<> (q ?x) (q ?x)
|
||
|
<> ((unwrap ?x)) (unwrap ?x)
|
||
|
<> (unwrap ((?x))) (unwrap (?x))
|
||
|
<> (unwrap ?x) ?x
|
||
|
<> (if ?c ?t ?f) (if/q ?c q ?t q ?f)
|
||
|
<> (if/q (true) q ?t q ?f) (unwrap ?t)
|
||
|
<> (if/q (false) q ?t q ?f) (unwrap ?f)
|
||
|
<> (== (?x) (?x)) (true)
|
||
|
<> (== (?x) (?y)) (false)
|
||
|
<> (math ?: ?0 ?1) ?:
|
||
|
<> (+ (?x) (?y)) (math + ?x ?y)
|
||
|
<> (- (?x) (?y)) (math - ?x ?y)
|
||
|
<> (* (?x) (?y)) (math * ?x ?y)
|
||
|
|
||
|
(defun factorial (?n)
|
||
|
(if (== (?n) (1))
|
||
|
(?n)
|
||
|
(* (?n) (factorial (- (?n) (1))))))
|
||
|
|
||
|
(factorial (5))
|