Created
February 13, 2013 04:12
-
-
Save boxxxie/4942206 to your computer and use it in GitHub Desktop.
cool little clojure code snippet
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
(defmacro as-> | |
"Binds name to expr, evaluates the first form in the lexical context | |
of that binding, then binds name to that result, repeating for each | |
successive form, returning the result of the last form." | |
{:added "1.5"} | |
[expr name & forms] | |
`(let [~name ~expr | |
~@(interleave (repeat name) forms)] | |
~name)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment