Created
January 21, 2014 13:31
-
-
Save gosub/8540067 to your computer and use it in GitHub Desktop.
Variable binding in a clojure threading macro, simulating a Haskell where clause
This file contains 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
(defmacro where [& body] | |
"where is identical to let, but with bindings | |
at the end of the argument list." | |
`(let ~(last body) | |
~@(butlast body))) | |
(-> 5 | |
(+ i) | |
(- j) | |
(where [i 3 j 2])) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment