no continuations

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


On Friday, January 09, 2004 2:48 AM, Ashley Yakeley 
[SMTP:ashley at semantic.org] 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 
this.

http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&oe=UTF-8&th=fdcf3  
554852a3cad&seekm=3AC66F16%40MailAndNews.com#link1
http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&oe=UTF-8&th=a47e0  
3e456b2dc2a&seekm=200102220358.TAA77339%40adric.cs.nps.navy.mil#link1
http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&oe=UTF-8&th=58a68  
6525be78d16&rnum=1



More information about the Haskell-Cafe mailing list