Skip to content

Instantly share code, notes, and snippets.

@si14
Last active December 22, 2015 02:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save si14/0dadea5bd7f23de47544 to your computer and use it in GitHub Desktop.
Save si14/0dadea5bd7f23de47544 to your computer and use it in GitHub Desktop.
(def ^{:dynamic true} testvar)
(defmacro test1 [& body]
(let [important-data 42]
`(binding [testvar ~important-data]
~@body)))
(defmacro test2 []
(prn "compile time:" testvar) ;; unbound
`(prn "run time: " testvar) ;; 42)
(test1 (+ 1 2) (test2) :ok)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment