Created
October 22, 2021 04:16
-
-
Save mikeananev/90761ac4b154095c8ee96b489457b522 to your computer and use it in GitHub Desktop.
Clojure macro to build map from symbols.
This file contains hidden or 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 ->map | |
"(->map a b) ;;=> {:a a :b b}" | |
[& symbols] | |
(assert (every? symbol? symbols)) | |
`(hash-map | |
~@(interleave (map keyword symbols) symbols))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment