Hello everybody, I just wrote a simple macro for debugging the ->> .. just thought of sharing it with you all
(defmacro print-and-return ([x] `(let [x# ~x] (println x#) x#)) ([flag x] `(let [flag# '~flag x# ~x] (println flag#) (println x#) x#))) (defmacro ->>d [ & args] `(->> ~@(interpose 'print-and-return args) print-and-return)) (defmacro ->>dd [& args] `(->> ~@(interleave args (map (fn [x] (list 'print-and-return x)) args)))) ;-------------------------- (->>dd (range 10) (map inc) (filter even?)) (range 10) (0 1 2 3 4 5 6 7 8 9) (map inc) (1 2 3 4 5 6 7 8 9 10) (filter even?) (2 4 6 8 10) ;------------------------------------- (->>d (range 10) (map inc) (filter even?)) (0 1 2 3 4 5 6 7 8 9) (1 2 3 4 5 6 7 8 9 10) (2 4 6 8 10) ;---------------------------------- would love to see some of the other macros that you all have written to enable debugging.. :) thanks, Sunil. -- 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 Note that posts from new members are moderated - please be patient with your first post. 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