Skip to content

Instantly share code, notes, and snippets.

@alandipert
Forked from fogus/plet.clj
Created July 29, 2012 18:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alandipert/3201027 to your computer and use it in GitHub Desktop.
Save alandipert/3201027 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