guile-devel
[Top][All Lists]
Advanced

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

Re: trace fix


From: Neil Jerram
Subject: Re: trace fix
Date: 26 Jun 2001 22:58:50 +0100
User-agent: Gnus/5.0808 (Gnus v5.8.8) Emacs/20.7

>>>>> "Martin" == Martin Grabmueller <address@hidden> writes:

    Martin> Hello, I have found some time to play around, and Neil's
    Martin> fix for the `trace' procedure works fine for the various
    Martin> tests I've done.  I think it should get committed.

It's in now:

guile> (define (fact1 n) (if (= n 0) 1 (* n (fact1 (- n 1)))))
guile> (trace fact1)
($ 4) => (fact1)
guile> (fact1 5)
[fact1 5]
|  [fact1 4]
|  |  [fact1 3]
|  |  |  [fact1 2]
|  |  |  |  [fact1 1]
|  |  |  |  |  [fact1 0]
|  |  |  |  |  1
|  |  |  |  1
|  |  |  2
|  |  6
|  24
120
($ 5) => 120
guile> (define (facti a n) (if (= n 0) a (facti (* a n) (- n 1))))
guile> (trace facti)                                              
($ 8) => (facti)
guile> (facti 1 5)                                                
[facti 1 5]
[facti 5 4]
[facti 20 3]
[facti 60 2]
[facti 120 1]
[facti 120 0]
120
($ 9) => 120
guile> 

        Neil




reply via email to

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