You should take a look at tools.trace [1]. A minimal example:

    (ns trc.core
      (:use [clojure.tools.trace :only [deftrace]]))

    (deftrace fib [n]
      (if (or (= n 0) (= n 1))
        1
       (+ (fib (- n 1)) (fib (- n 2)))))

the following is printed when (fib 4) is evaluated:

TRACE t2302: (fib 4)
TRACE t2303: | (fib 3)
TRACE t2304: | | (fib 2)
TRACE t2305: | | | (fib 1) 
TRACE t2305: | | | => 1
TRACE t2306: | | | (fib 0)
TRACE t2306: | | | => 1
TRACE t2304: | | => 2
TRACE t2307: | | (fib 1)
TRACE t2307: | | => 1
TRACE t2303: | => 3
TRACE t2308: | (fib 2)
TRACE t2309: | | (fib 1)
TRACE t2309: | | => 1
TRACE t2310: | | (fib 0)
TRACE t2310: | | => 1
TRACE t2308: | => 2
TRACE t2302: => 5


[1]: https://github.com/clojure/tools.trace

-- 
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

Reply via email to