Added wryls lisp example
This commit is contained in:
parent
0f3c1b4fb8
commit
1f7e382c92
|
@ -0,0 +1,22 @@
|
||||||
|
<> ((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))
|
Loading…
Reference in New Issue