I'm trying to write a simple macro that will do CL-style call tracing for me. When I try to use it, however, I'm getting an "ExceptionInInitializerError." I don't know what this actually means, though I'm sure I'm just doing something very stupid. I was hoping someone on this list could help point out what I am doing wrong. I ran
user=> (defmacro tracefn [function-name] "Creates trace logging of calls to a function." `(def ~function-name (let [old-function# ~(eval function-name)] (fn [& args#] (println args#) (print " ") (let [ret-val# (apply old-function# args#)] (println ret-val#) ret-val#))))) nil user=> (defn poor-mans-multiply [x y] (if (> x 0) (+ y (poor-mans-multiply (dec x) y)) 0)) #'user/poor-mans-multiply user=> (poor-mans-multiply 3 4) 12 user=> (tracefn poor-mans-multiply) java.lang.ExceptionInInitializerError (NO_SOURCE_FILE:0) user=> (tracefn 'poor-mans-multiply) java.lang.Exception: Second argument to def must be a Symbol (NO_SOURCE_FILE:370) user=> (poor-mans-multiply 3 4) 12 user=> What am I doing wrong? --Eric Tschetter --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---