Mark H Weaver <m...@netris.org> writes:

> The 'letrec' form above is indeed invalid.  As the R5RS states:
>
>      One restriction on 'letrec' is very important: it must be possible
>      to evaluate each <init> without assigning or referring to the value
>      of any <variable>.  If this restriction is violated, then it is an
>      error.  The restriction is necessary because Scheme passes
>      arguments by value rather than by name.  In the most common uses of
>      'letrec', all the <init>s are lambda expressions and the
>      restriction is satisfied automatically.

Yeah, I'd read that originally, but not paid quite close enough
attention (obviously).  Switching to a wrapper lambda worked just fine.

> This particular example happens to work when compiled by recent versions
> of Guile, but that's suboptimal.  Ideally, we should report an error in
> this case.

Indeed, not strictly necessary, but would have been nice, so I'd have
realized more quicly that I was doing it wrong.

Thanks again for the help.
-- 
Rob Browning
rlb @defaultvalue.org and @debian.org
GPG as of 2011-07-10 E6A9 DA3C C9FD 1FF8 C676 D2C4 C0F0 39E9 ED1B 597A
GPG as of 2002-11-03 14DD 432F AE39 534D B592 F9A0 25C8 D377 8C7E 73A4

Reply via email to