[plt-scheme] Re: trace?

From: Warren Henning (warren.henning at gmail.com)
Date: Sat Aug 19 18:36:46 EDT 2006

> Message: 3
> Date: 19 Aug 2006 18:16:55 -0000
> From: Paul Graham <pg at ycombinator.com>
> Subject: [plt-scheme] trace?
> To: plt-scheme at list.cs.brown.edu
> Message-ID: <20060819181655.31561.qmail at mail.archub.org>
>
> Is there anything in mzscheme analogous to cl's trace function?
> How do you trace the execution of a function?  Thanks, --pg

I wondered this myself. Googling around, I find a file trace.ss that
seems to have a bit of what you're looking for. Consider the following
code:

(require (lib "trace.ss"))

;; simple function to test tracing - just computes list length the hard way
(define (test-func lst)
  (if (null? lst)
      0
      (+ 1 (test-func (cdr lst)))))

(trace test-func)

Then if we evaluate (test-func '(a b c d)) we get:

> (test-func '(a b c d))
|(test-func (a b c d))
| (test-func (b c d))
| |(test-func (c d))
| | (test-func (d))
| | |(test-func ())
| | |0
| | 1
| |2
| 3
|4
4
>

Eh? Seems like a start. Good luck with the Winter Founders proposals!

Warren Henning


Posted on the users mailing list.