[plt-scheme] Trace
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