[plt-scheme] about letrec and continuation : which behavior is correct ? and why ?

From: Woodhouse Gregory (gregory.woodhouse at gmail.com)
Date: Thu Aug 21 00:27:14 EDT 2008

On Aug 20, 2008, at 12:51 PM, Shriram Krishnamurthi wrote:

> If LOCAL had a slightly less onerous syntax (the current syntax meets
> one need superbly, but at the cost of some syntactic pain for people
> writing a fresh LOCAL expression from scratch), would you object to it
> supplanting LETREC?
>
> S.

I guess it depends on what you mean by "supplant". I wouldn't be  
happy to see LETREC disappear from the language, even if it weren't  
actually needed, or if it could be replaced with reasonable clarity  
by another construct (I wouldn't put LET ... SET! ... in this  
category). Maybe it's just a matter of tradition - or familiarity. In  
any case, one thing that bothers me is that LOCAL just seems too  
mysterious (or maybe it's really DEFINE that is mysterious). The  
Reference says that LOCAL is like LETREC "except that bindings are  
expressed in the same way as in top-level or in a module body". The  
Reference the points to section 1.2.3.6 on partial expansion, which  
certainly helps, and confirms intuition about what a self-referential  
DEFINE could possibly mean. When I look up LETREC, I read (section  
2.9): "Similar to let, but the location for all ids are created first  
and filled with #<undefined>..." That doesn't sound the same at all.  
Or does it? If I think intuitively about how I might read a LETREC, I  
think about creating mental placeholders and filling them in as I go,  
so it kind of comes down to the same process. But enough of me  
thinking out loud.

The problems to me seem twofold: I never learned or used LOCAL when  
learning Scheme, and try to avoid using internal DEFINEs. I suspect a  
lot of other people are in the same boat. The other is that LOCAL and  
LETREC are generally presented in different ways, and it's not  
obvious that (or if) they are operationally equivalent.


"Mathematics is the science of patterns."
--Lynn Arthur Steen, 1988

http://www.gwoodhouse.com
http://GregWoodhouse.ImageKind.com





-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20080820/411567dc/attachment.html>

Posted on the users mailing list.