Last active
November 6, 2015 16:21
-
-
Save Leonidas-from-XIV/e497dd5a4b5aa5971d52 to your computer and use it in GitHub Desktop.
Do you even need `if` or `cond` as special forms?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(def TRUE (fn [x] (fn [y] x))) | |
;=> #'user/TRUE | |
(def FALSE (fn [x] (fn [y] y))) | |
;=> #'user/FALSE | |
(def AND (fn [p] (fn [q] ((p q) p)))) | |
;=> #'user/AND | |
((AND TRUE) FALSE) | |
;=> #object[user$FALSE 0x47a57da0 "user$FALSE@47a57da0"] | |
(def IFTHENELSE (fn [p] (fn [a] (fn [b] ((p a) b))))) | |
;=> #'user/IFTHENELSE | |
(((IFTHENELSE ((AND TRUE) TRUE)) "yes") "no") | |
;=> "yes" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment