hy/tests/native_tests/contrib/curry.hy

14 lines
298 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))
(defn test-curry []
(assert (= 16 (((((s ((((k s) k) i) i)) (i i)) ((i (i i))
((((k s) i) ((s (k s)) k)) i))) succ) 0))))