Skip to content

Instantly share code, notes, and snippets.

@boxxxie
Created February 13, 2013 04:12
Show Gist options
  • Save boxxxie/4942206 to your computer and use it in GitHub Desktop.
Save boxxxie/4942206 to your computer and use it in GitHub Desktop.
cool little clojure code snippet
(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