Skip to content

Instantly share code, notes, and snippets.

View pushpankar's full-sized avatar
🎧
Focusing

Pushpankar Kumar Pushp pushpankar

🎧
Focusing
  • London
View GitHub Profile
(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))