On Mar 24, 2009, at 15:44, Mark Volkmann wrote: > I'm wondering if there is a way to avoid that using a macro. The hard > part is printing the expression. The following doesn't work. It > outputs "3 = 3". > > (defmacro dump2 [expr] > `(let [value# ~expr] > (pr ~expr) > (println " =" value#))) > (dump2 (+ 1 2))
All it takes to make it work is a slight modification: (defmacro dump [expr] `(let [value# ~expr] (pr (quote ~expr)) (println " =" value#))) (dump (+ 1 2)) prints: (+ 1 2) = 3 Konrad. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~----------~----~----~----~------~----~------~--~---