Last active
August 29, 2015 13:58
-
-
Save galdolber/9946533 to your computer and use it in GitHub Desktop.
Compile time bindings
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
(use 'clojure.walk) | |
(def ^:dynamic clazz) | |
(defmacro defout [& other] | |
(binding [clazz (first other)] | |
(let [other (mapv macroexpand-all other)] | |
`(~@other)))) | |
(defmacro defin [& other] | |
`(~@other ~clazz)) | |
(macroexpand-all | |
'(defout A | |
(defin :a))) | |
; => (A (:a A)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment