no continuations

Kevin S. Millikin kmillikin at
Fri Jan 9 11:25:21 EST 2004

On Friday, January 09, 2004 2:48 AM, Ashley Yakeley 
[SMTP:ashley at] wrote:
> Do you have an example of use of Y for letrec where a program would
> violate R5RS?

Sure, take a look at my implementation of Ben Rudiak-Gould's 
implementation of Alan Bawden's implementation of boxes.

In 4.2.2 of R5RS, it says, re letrec:

Semantics: The <variable>s are bound to fresh locations holding 
undefined values, the <init>s are evaluated in the resulting 
environment (in some unspecified order), each <variable> is assigned to 
the result of the corresponding <init>, the <body> is evaluated in the 
resulting environment, and the value(s) of the last expression in 
<body> is(are) returned. Each binding of a <variable> has the entire 
`letrec' expression as its region, making it possible to define 
mutually recursive procedures.

The result of the corresponding <init> is *assigned to* each <variable> 
(anyone know why the wording is backward above?), and that is after the 
<init>s are evaluated, which is after the <variable>s are bound.

There was a discussion on comp.lang.scheme a couple of years ago about 

More information about the Haskell-Cafe mailing list