Skip to content

Instantly share code, notes, and snippets.

@michalmarczyk
Created April 28, 2010 09:11
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 michalmarczyk/381904 to your computer and use it in GitHub Desktop.
Save michalmarczyk/381904 to your computer and use it in GitHub Desktop.
macrolet example
(defmacro defmap [name & body]
(let [g (gensym)]
`(macrolet [(~'add [k# v#] `(swap! ~'~g assoc ~k# ~v#))]
(let [~g (atom {})]
~@body
(def ~name (deref ~g))))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment