This is the mail archive of the
guile@sourceware.cygnus.com
mailing list for the Guile project.
Re: Bug with letrec???
- To: Lars Arvestad <arve at nada dot kth dot se>
- Subject: Re: Bug with letrec???
- From: Michael Livshin <mlivshin at bigfoot dot com>
- Date: 20 Mar 2000 14:24:53 +0200
- Cc: Norbert Preining <preining at logic dot at>, guile at sourceware dot cygnus dot com
- Organization: who? me?
- References: <20000320092038.A17184@mandala.priv.at> <vd98zzdvnnh.fsf@rocky.biokemi.su.se>
Lars Arvestad <arve@nada.kth.se> writes:
> NP> it seems that letrec is not working correct?! I thought this is the
> NP> standard behaviour according to RnRS? What is the difference between
> NP> letrec and let in this case?
>
> It works correct. Here is from R5RS:
>
> 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.
an interesting thing is that at least in Scsh and MzScheme letrec
works as Norbert expected. but yes, per R5RS it doesn't have to.
--
"What did we agree about a leader??"
"We agreed we wouldn't have one."
"Good. Now shut up and do as I say..."