Created
February 18, 2014 22:33
-
-
Save amalloy/9081844 to your computer and use it in GitHub Desktop.
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 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) (butlast forms))] | |
~(last forms))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment