Created
January 29, 2015 15:33
-
-
Save mwmitchell/2db95d5b2f5264102f3e to your computer and use it in GitHub Desktop.
defmacro for dynamic def name
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
(def names {:foo 'FOO}) | |
(defmacro def* [dname dval] | |
`(def ~dname ~dval)) | |
;; This doesn't resolve the (get names :foo) => 'FOO | |
(macroexpand-1 '(def* (get names :foo) 300)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment