[plt-scheme] Trace

From: Christian Wagenknecht (c.wagenknecht at arcor.de)
Date: Thu Oct 9 23:35:21 EDT 2003

Hi,

mymember as given below is a tail recursive procedure.

(define mymember
 (lambda (x ls)
   (cond
     [(null? ls) #f]
     [(eq? x (car ls))(cons x (cdr ls))]
     [else
      (mymember x (cdr ls))])))

Unfortunately the trace of (mymember 3 '(1 2 3 4 5)) works not as expected:

> (mymember 3 '(1 2 3 4 5))
|(mymember 3 (1 2 3 4 5))
| (mymember 3 (2 3 4 5))
| |(mymember 3 (3 4 5))
| |(3 4 5)
| (3 4 5)
|(3 4 5)
(3 4 5)

All calls should be on the same level, but it's not. In contrast when using the Chez Scheme tracer it works fine well. 

> (mymember 3 '(1 2 3 4 5))
|(mymember 3 (1 2 3 4 5))
|(mymember 3 (2 3 4 5))
|(mymember 3 (3 4 5))
|(3 4 5)
(3 4 5)

Is there a bug in trace.ss?

--Christian



Posted on the users mailing list.