Skip to content

Instantly share code, notes, and snippets.

@patrickdlogan
Forked from fogus/plet.clj
Created November 2, 2012 19:57
Show Gist options
  • Save patrickdlogan/4003963 to your computer and use it in GitHub Desktop.
Save patrickdlogan/4003963 to your computer and use it in GitHub Desktop.
(defmacro letp
[bindings & exprs]
(let [bindings (partition 2 bindings)
vars (->> bindings (map first) vec)
values (->> bindings (map second))]
`((fn ~vars ~@exprs)
~@values)))
(def a 7)
(def y 2)
(let [a 5 b a] b)
;;=> 5
(letp [a 5 b a] b)
;;=> 7
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment