Created
June 10, 2012 23:41
-
-
Save gtrak/2907736 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defmacro let-map | |
"Avoids having to build maps from let bindings manually" | |
[bindings] | |
(let [names (->> (tree-seq #(or (vector? %) (map? %)) identity bindings) | |
(filter symbol?)) | |
bindings (destructure bindings)] | |
`(let [~@bindings] | |
(zipmap [~@(map (comp keyword name) names)] | |
[~@names])))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment