[plt-scheme] why local? (just curious)

From: John Clements (clements at brinckerhoff.org)
Date: Thu Jan 15 13:16:32 EST 2009

On Jan 15, 2009, at 9:12 AM, Sigrid Keydana wrote:

> :Hi Shriram,
> thanks for your patience :-) . In fact I'm not asking about sequential
> assignment per se (I have been using let* for that), but in which
> situation I would need this in combination with the mutual recursion
> provided by letrec.
> Now I've tried to think up an example myself in which both is  
> present -
> as I can't get at anything sensible, I just put some sequential
> assignment in the beginning of the classic even-odd-letrec-example:
> (define test
>  (lambda (n)
>    (letrec ((start-value n)
>             (zero (- start-value start-value))
>             (even? (lambda (n) (if (= n zero) #t (odd? (- n 1)))))
>             (odd? (lambda (n) (if (= n zero) #f (even? (- n 1))))))
>      (odd? n))))
> (test 333)
> The stupid example at least seems to show that with letrec, I get the
> sequential assignment too... - or do I miss something here?

I'm not doing due diligence here, but I believe that RnRS[*] does not  
guarantee (or even permit?) this behavior, but that PLT scheme does,  
and has, for at least five to ten years.

Feel free to correct me.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2484 bytes
Desc: not available
URL: <http://lists.racket-lang.org/users/archive/attachments/20090115/3c9f8ee2/attachment.p7s>

Posted on the users mailing list.