-
-
Save pushpankar/259267917b50941ad115aaf889af87f1 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defmacro trace-letfn [fnspecs & body] | |
(let [mod-fns (mapv #(let [[name args & body] %] | |
`(~name ~args (t/trace-fn-call '~name (fn ~args ~@body) ~args))) | |
fnspecs)] | |
`(letfn ~mod-fns ~@body))) | |
(trace-letfn [(f [n] (println "Thing" n)) | |
(g [m] (println "Somethin else" m))] | |
(f 1) | |
(g 2)) | |
TRACE t1951: (f 1) | |
Thing 1 | |
TRACE t1951: => nil | |
TRACE t1952: (g 2) | |
Somethin else 2 | |
TRACE t1952: => nil | |
=> nil |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment