Skip to content

Instantly share code, notes, and snippets.

@galdolber
Last active August 29, 2015 13:58
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 galdolber/9946533 to your computer and use it in GitHub Desktop.
Save galdolber/9946533 to your computer and use it in GitHub Desktop.
Compile time bindings
(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