Skip to content

Instantly share code, notes, and snippets.

@micha
Last active August 29, 2015 14:06
Show Gist options
  • Select an option

  • Save micha/1f102615849d77dbbed1 to your computer and use it in GitHub Desktop.

Select an option

Save micha/1f102615849d77dbbed1 to your computer and use it in GitHub Desktop.
Clojure macro defines a macro which evaluates expressions with some bindings.
(defmacro defbound [sym bindings]
`(defmacro ~sym [& body#]
`(let ~'~bindings ~@body#)))
(comment
user=> (defbound with-xy [x 100 y 200])
#'user/with-xy
user=> (with-xy (+ x y))
300
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment