hy/eg/curry/ski.hy

13 lines
278 B
Hy
Raw Normal View History

2014-01-29 02:27:39 +01:00
(require hy.contrib.curry)
(defnc s [x y z] ((x z) (y z))) ; λxyz.xz(yz)
(defnc k [x] (fn [y] x)) ; λx.λy.x
(defnc i [x] x) ;; λx.x
(defnc succ [n] (+ n 1))
(print (((((s ((((k s) k) i) i)) (i i)) ((i (i i))
((((k s) i) ((s (k s)) k)) i))) succ) 0))