[racket] iterative lazy space-safe or not?

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

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?

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?

Keiko






Posted on the users mailing list.