[racket] iterative lazy space-safe or not?

From: Keiko Nakata (keiko at kurims.kyoto-u.ac.jp)
Date: Mon Nov 15 10:07:47 EST 2010

Thanks for the reply.

Is there some material (preferably something that I can refer to as well), 
which supports this implementation? 

It looks clever.

Keiko


From: Eli Barzilay <eli at barzilay.org>
Subject: Re: [racket] iterative lazy space-safe or not?
Date: Mon, 15 Nov 2010 07:28:49 -0500

> 20 minutes ago, Keiko Nakata wrote:
> > Hi,
> > 
> > In the post-finalization discussion on iterative lazy algorithms (SRFI 45),
> > (http://srfi.schemers.org/srfi-45/post-mail-archive/msg00024.html)
> > Andre van Tonder points that Eli's proposal, 
> > which I think is used in Racket roughly, is not memory safe.
> > But I do not get his point.
> > 
> > (force (letrec ([x1 (lazy x2)] [x2 (lazy x3)] [x3 (lazy 4)]) x1))
> > 
> > ends up with a graph in which x1 points to 4 and both x2 and x3
> > point to x1.  Am I correct?
> 
> Yes.
> 
> 
> > And indeed I do not get out-of-memory for 
> > 
> > (define (g x) (lazy (begin (garbage-collect) (g x))))
> > 
> > Is the problem mentioned in the discussion specific to stream
> > implementation?  Or, am I missing something?
> 
> I don't remember the details exactly, but I think that there was some
> other bug at the time.
> 
> -- 
>           ((lambda (x) (x x)) (lambda (x) (x x)))          Eli Barzilay:
>                     http://barzilay.org/                   Maze is Life!


Posted on the users mailing list.