chicken-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Chicken-users] Tracing (Another NOOB Q)


From: Mario Domenech Goulart
Subject: Re: [Chicken-users] Tracing (Another NOOB Q)
Date: Tue, 01 Nov 2011 11:53:51 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.91 (gnu/linux)

Hi Curtis,

On Tue, 1 Nov 2011 08:52:09 -0700 Curtis Cooley <address@hidden> wrote:

> In the manual on the wiki it says you can use the ,tr command to trace
> a function like:
>
> #;5> ,tr fact
> #;5> (fact 3)
> |(fact 3)
> | (fact 2)
> |  (fact 1)
> |   (fact 0)
> |   fact -> 1
> |  fact -> 1
> | fact -> 2
> |fact -> 6
> 6
>
> but there does not appear to be a ,tr command anymore. I've tried a
> couple of the others that seemed similar, but could not find anything.
> This would be really helpful as I make my way through SICP. Can it
> still be done?

Thanks for pointing that out.  The ,tr command has indeed been removed
(version 4.3.0).  I've fixed the manual.

You can use the trace egg (http://wiki.call-cc.org/egg/trace).  Here's
an example:

  csi> (use trace)
  csi> (define (fact n) (if (< n 2) 1 (* n (fact (- n 1)))))
  csi> (trace fact)
  ; tracing fact
  csi> (fact 3)
  [0] (fact 3)
   [1] (fact 2)
    [2] (fact 1)
    [2] fact -> 1 
   [1] fact -> 2 
  [0] fact -> 6 
  6

Best wishes.
Mario
-- 
http://parenteses.org/mario



reply via email to

[Prev in Thread] Current Thread [Next in Thread]