I've seen a few variations of the following code logging macro:
(defmacro log
"for debugging, output code and code->val to stdout, returns val"
[code]
`(let [c# ~code]
(prn '~code)
(clojure.pprint/pprint c#)
c#))
however, I haven't seen a recursive version that wraps all macro or function forms in the code-body. Does anyone have good working implementation?
EDIT:
To clarify, take for example the following code:
(map #(+ % 10) (range 5))
by wrapping that in a recursive-log macro:
(r-log (map #(+ % 10) (range 5)))
the macro-expansion of that should be:
(log (map #(log (+ % 10)) (log (range 5))))