On Fri, Jul 15, 2016 at 06:50:11PM +0000, Mike Gran wrote: > > On Friday, July 15, 2016 7:27 AM, Pierre Lairez <[email protected]> > wrote: > > > > > > >Dear guile users, > > > >When running the following loop: > >(do ((i 1 (+ 1 i)) > > (j 0 i)) > > ((> i 4) (newline)) > > (display (list i j))) > > > >I expect without hesitation to read > >(1 0)(2 1)(3 2)(4 3) > > > >To my surprise, I obtain > >(1 0)(2 2)(3 3)(4 4) > > > Yeah, I get the same in 2.0.11 > > I don't know the correct terminology > > The "i" in (j 0 i) is a reference to > > the "i" that is bound (+ 1 i). > > You can prove this by running the following > > (do ((i 1 (+ 1 i)) (j 0 (+ i 0))) > ((> i 4) (newline)) > (display (list i j))) >
Yes, I used ,expand to see what's happening, and it seems that named let is broken: if you replace i with (+ i 0) it uses `some other i'. -- Vladimir
