Carp/examples/nested_lambdas.carp
2020-06-15 21:44:11 +02:00

19 lines
390 B
Plaintext

(defn my-curry [f] (fn [x] (fn [y] (f x y))))
(defn double-curry [f] (fn [x] (fn [y] (fn [z] (f x y z)))))
(defn make-cb []
((fn []
(let [x "hi"]
(fn [] (IO.println x))))))
(defn make-cb2 []
((fn []
(let [x "hello"
f (fn [] (IO.println x))]
f))))
(defn main []
(do ((make-cb))
((make-cb2))
(((my-curry (fn [x y] (Int.+ x y))) 1) 2)))