clojure - How to expand macro within other macro's scope (trying to debug a macro) -
After
Here is the simplest example I can do:
(defmacro printer [& amp; Forms (`println ~ @ forms)) (defmacro connector [s]` (inc / s)) They can be used as expected: < Pre> (printer "haha") = & gt; "Haha" (connector1) => 2 and I can macroexpand to see what macro they did: (macroexpand '(printer 1) ) = & Gt; (Closeor.core / print1) (macroxpand '(connector1)) = & gt; (Clojure.core / Ink 1) But when they are nested I do not get what I want:
(printers (printer) Copula 1))))) =) (Clojure.core.println (joiner 1)) I was expecting to get
= & gt; (Clojure.core.println (clojure.core / inc1)) Is there any way for me to expand nested macros? This will help me a lot in debugging a specific bug.
you
(use 'clojure.walk) (macroexpand- All '(printer (connector 1))); (Clojure.core / println (clojure.core / Ink1))
Comments
Post a Comment