I struggled to find an answer or develop a solution. I am trying to figure out how to make code that makes code in Clojure. For my first feat, I want a function that will print for stdout the symbol name and its value, useful for debugging. Example:
(def mysymbol 5) (debugging-function mysymbol) mysymbol: 5
It makes sense? Thank you for your help.
Update after discussion
Here is the answer from @amalloy:
(defmacro ? "A useful debugging tool when you can't figure out what going on: wrap a form with ?, and the form will be printed alongside its result. The result will still be passed along." [val] `(let [x# ~val] (prn '~val '~'is x#) x#))
So: (? myvariable)
source share