[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


In the post-finalization discussion on iterative lazy algorithms (SRFI 45),
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?


Posted on the users mailing list.