Re: letrec semantics

2022-12-01 Thread Linus Björnstam
Guile implements letrec using letrec*, which most schemes always did, but it wasn't specified due to people wanting to leave possible optimisations on the table. The order of letrec is unspecified and schemes are allowed to do whatever order they like. Guile uses the algorithm described in "fi

Re: letrec semantics

2022-11-30 Thread Alexander Asteroth
Dear Jean, thanks for pointing that out which confirmed my interpretation of the R5RS. Cheers, Alex On Mon, Nov 28 2022, 10:25:46, Jean Abou Samra wrote: > [[PGP Signed Part:Undecided]] > Le 28/11/2022 à 09:33, Alexander Asteroth a écrit : > > Dear all, > > I know this topic has been discuss

Re: letrec semantics

2022-11-30 Thread Alexander Asteroth
Dear Taylan, thanks for pointing me to the use of letrec* in this case. The case though was meant as an example to illustrate the problem. I'm currently implementing an R5RS interpreter and was unsure if I can handle letrec as illustrated below in the second case or if I need to implement it as gu

Re: letrec semantics

2022-11-28 Thread Taylan Kammer
On 28.11.2022 09:33, Alexander Asteroth wrote: > >> scheme@(guile-user)> (letrec ((b a)(a 7)) b) >> $1 = 7 > > should be equivalent (of course in a new scope) to: > >> scheme@(guile-user)> (define b #nil) >> scheme@(guile-user)> (define a #nil) >> scheme@(guile-user)> (set! b a) >> scheme@(guile

Re: letrec semantics

2022-11-28 Thread Jean Abou Samra
Le 28/11/2022 à 09:33, Alexander Asteroth a écrit : Dear all, I know this topic has been discussed in the past. I found at least one discussion in 2003 inguile-u...@gnu.org which in the end referred to even earlier discussions in comp.lang.scheme. But still I'm confused about this and wonder if