Skip to content

Instantly share code, notes, and snippets.

@gtrak
Created May 21, 2012 19:46
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 gtrak/2764230 to your computer and use it in GitHub Desktop.
Save gtrak/2764230 to your computer and use it in GitHub Desktop.
(defmacro to-map []
(let [keys# (keys &env)
keywords# (map keyword keys#)]
`(zipmap [~@keywords#] [~@keys#])))
;-> (let [c 1] (let [a 1 b (inc a)] (to-map)))
;{:c 1, :a 1, :b 2}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment