[PRL] scope of top-level defines

Eli Barzilay eli at barzilay.org
Mon Apr 4 22:46:27 EDT 2005


On Apr  4, Paul A. Steckler wrote:
> If you try to load the following code into GHCi, the 
> interactive Haskell interpreter:
> 
>   x = y
>   y = x

What does it do if you just enter the first one?


> [...]
> which is as general as you can get.  Of course, if you try to 
> evaluate x (or y), it just loops.  Now that's undefined for you!

Here:

| mzscheme -t lazy.ss
| Welcome to MzScheme version 209, Copyright (c) 2004 PLT Scheme, Inc.
| > (define x (cons 1 y))
| > (define y (cons 2 x))
| > (take 10 x)
| (1 2 1 2 1 2 1 2 1 2)

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



More information about the PRL mailing list