Revision: 12770
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at March 27, 2009 13:32 by narkisr
Initial Code
(defn trace-wrap [v]
(let [f (var-get v)
fname (:name ^v)]
(fn [& args]
(println "calling" fname)
(let [rtn (apply f args)]
(println "done with" fname)
rtn))))
(defn add [x y]
(println "adding" x "and" y)
(+ x y))
(prn (add 4 5))
(defmacro trace-fn [v & body]
`(binding [~v (trace (var ~v))]
~@body))
(trace-fn add
(prn (add 4 5)))
Initial URL
Initial Description
Shows how its possible to do AOP like programing in clojure.
Initial Title
AOP tracing in clojure
Initial Tags
Initial Language
Lisp