Last active
December 21, 2015 05:28
-
-
Save steveshogren/6256820 to your computer and use it in GitHub Desktop.
Copied fromTim Visher's tools.trace documentation https://github.com/timvisher/what-does-tools-trace-do/blob/master/src/what_does_tools_trace_do/core.clj
This file contains 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
;; example up from clouredocs.org: | |
;; http://clojuredocs.org/clojure_contrib/clojure.contrib.trace/deftrace | |
(deftrace fib [n] | |
(if (or (= n 0) (= n 1)) | |
1 | |
(+ (fib (- n 1)) (fib (- n 2))))) | |
(fib 4) | |
;; => 5 | |
;; 1> TRACE t2742: (fib 4) | |
;; TRACE t2743: | (fib 3) | |
;; TRACE t2744: | | (fib 2) | |
;; TRACE t2745: | | | (fib 1) | |
;; TRACE t2745: | | | => 1 | |
;; TRACE t2746: | | | (fib 0) | |
;; TRACE t2746: | | | => 1 | |
;; TRACE t2744: | | => 2 | |
;; TRACE t2747: | | (fib 1) | |
;; TRACE t2747: | | => 1 | |
;; TRACE t2743: | => 3 | |
;; TRACE t2748: | (fib 2) | |
;; TRACE t2749: | | (fib 1) | |
;; TRACE t2749: | | => 1 | |
;; TRACE t2750: | | (fib 0) | |
;; TRACE t2750: | | => 1 | |
;; TRACE t2748: | => 2 | |
;; TRACE t2742: => 5 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment