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

From: Woodhouse Gregory (gregory.woodhouse at gmail.com)
Date: Thu Aug 21 01:03:42 EDT 2008

On Aug 20, 2008, at 9:25 PM, Joe Marshall wrote:

> The thing I *really* want is for there to be a subset of Scheme
> that supports pure functional programming where it is obvious,
> by cursory inspection, that there are no side effects.  No explicit
> calls to SET! (or set-car!, rplaca, etc.) means no side effects
> period.  R5RS didn't have this because it required letrec to expand
> into let + set! whether it needed it or not.  I was hoping that
> R6RS would improve on this by at least *allowing* an implementation
> to use a fixed-point if possible.
>

Me, too.

In the case of letrec, though, what if it were primitive? It might be  
implemented using let/set! (or something like it) but its only side- 
effect
is to bind a name. If I recall correctly, Haskell uses a single let  
that allows for recursive definitions much like letrec in Scheme.

It would be interesting to have a fixed point operator made explicit  
in the language. I may be out of my depth here, but in a stack based
(as opposed to reduction based) implementation, I soppose that would  
mean capturing continuations (to handle the Y f => f steps).

> The more I program, the more I get the feeling that the case against
> side effects is vastly understated even by the people that object
> the most to them.
>



"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/baffe917/attachment.html>

Posted on the users mailing list.