[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Continuations and scheme level wrappers
From: |
Gary Houston |
Subject: |
Re: Continuations and scheme level wrappers |
Date: |
30 Nov 2000 20:19:06 -0000 |
> From: Mikael Djurfeldt <address@hidden>
> Date: Thu, 30 Nov 2000 18:01:46 +0100
>
> I saw your recent change maing continuations applicable smobs.
>
> Question: Will the new continuations be properly tail-recursive?
>
> They need to be...
>
> They should, for example, handle a situation where a recursion
> repeatedly creates a continuation and calls it tail-recursively
> without leaving anything on the stack.
Hi Mikael,
Do you mean something like this?
(define cont #f)
(define (a)
(call-with-current-continuation (lambda (c)
(set! cont c)))
(b))
(define (b)
(if (< (random 10) 5)
(cont #f)
(a)))
Judging by process size, this seems to be tail recursive when using
the normal evaluator but not when using the debugging evaluator.
I have a version of Guile from shortly before my changes which shows
the same behaviour.