Skip to content

Instantly share code, notes, and snippets.

@gosub
Created January 21, 2014 13:31
Show Gist options
  • Save gosub/8540067 to your computer and use it in GitHub Desktop.
Save gosub/8540067 to your computer and use it in GitHub Desktop.
Variable binding in a clojure threading macro, simulating a Haskell where clause
(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