[plt-scheme] Lazy Scheme and continuations

From: Eli Barzilay (eli at barzilay.org)
Date: Sun Dec 17 13:46:52 EST 2006

On Dec 16, Gregory Woodhouse wrote:
> Okay, this is a bit whimsical. I tried entering the following in
> Lazy Scheme (expecting something about an unbound identifier call/cc
> or some such)
> (define (f a)
>      (call/cc
>       (lambda (k)
>         (if (>= a 0) a
>             (k (- 0 a))))))
> It does correctly compute the absolute value in normal (er....better
> make that standard) Scheme, but (f -4) seems to loop indefinitely in
> Lazy Scheme. Now, maybe that's just the point, but I thought it
> might also be possible that it's due to an unrelated bug. Is this
> behavior "expected"?

My guess is that continuations do their usual thing of exposing
implementation details in subtle ways.  The current version uses
MzScheme promises -- I have a new implementation (which will be
comitted soon) that uses its own promise implementation (related to
recent discussions on the srfi-45 list), and your code works with it.

(BTW, I just included everything by default, with some sane treatment
of some features like `begin'.  I didn't even think of the effects of
using continuations in the lazy language...)

          ((lambda (x) (x x)) (lambda (x) (x x)))          Eli Barzilay:
                  http://www.barzilay.org/                 Maze is Life!

Posted on the users mailing list.