[plt-scheme] semantics of letrec in Lazy Scheme

From: Eli Barzilay (eli at barzilay.org)
Date: Tue Jun 2 09:04:22 EDT 2009

On Jun  2, Keiko Nakata wrote:
> Hello,
> In the following Lazy Scheme code, u is bound to #<undefiend>, 
> whereas u1 and u2 are to promises producing 5. 
> Why is u exceptional? 
> #lang lazy
> (define u (letrec ([x y] [y 5]) x))
> [...]

That looks like a bug.  It's a result of an optimization --
expressions are all delayed except when the expression is a literal
value or an identifier -- so the first `y' in the above is not in a

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

Posted on the users mailing list.