Re: STk not properly tail-recursive?

From: Erick Gallesio <>
Date: Thu, 06 Oct 1994 11:08:18 +0000

> It appears that the scheme implementation in STk 2.1 is not "properly
> tail-recursive" as mentioned in R4RS section 1.1. Is this true, or am
> I misunderstanding something?
> Section 1 of the STk Reference Manual doesn't mention any
> non-compliances with respect to the same section of R4RS.
> Here's my example code (which, I think, is tail-recursive, n'est-ce pas?):
> (define loop
> (lambda (count)
> (if (= 0 (remainder count 1000))
> (format #t "~a\n" count))
> (loop (+ count 1))))
> (loop 0)

The interpreter is "properly tail recursive" and the problem is elsewhere. It
seems that usage of bignum leads to a memory leak.
I'm starting to look at this bug.


                -- Erick

PS: If you want to convince you that the interpreter is tail recusrsive. Run
it under a debugger and ask for a back trace. In this case, you'll see that the
stack is low even if the memory consumption is high.
Consequently it should be a memory leak. The problem is that this kind of
bug is hard to track. However, as sson as I find a correction, I will post it
on the mailing-list

PS2: There are two points (I hope that 2 is the upper bound) where the
interpreter is not tail recursive: in dynamic-wind, in method application.
The former seems to be hard to "unrecursive", the latter should be easier.
However, I think that it will not be corrected for 2.2.
Received on Thu Oct 06 1994 - 11:08:19 CET

This archive was generated by hypermail 2.3.0 : Mon Jul 21 2014 - 19:38:59 CEST