According to page 20 of the September 2004 version of the manual, I would expect
(iter (for (the fixnum n) in '(3 5 7 8 9)) (counting (oddp n)))
to expand into a form in which n was declared/guaranteed fixnum. It does not. It binds n to nil initially, and (therefore?) omits the declaration.
(iter (for n in '(3 5 7 8 9)) (declare (fixnum n)) (counting (oddp n)))
does the right thing.
Cheers,
rif
On 2004-10-30, rif@mit.edu wrote:
According to page 20 of the September 2004 version of the manual, I would expect
(iter (for (the fixnum n) in '(3 5 7 8 9)) (counting (oddp n)))
to expand into a form in which n was declared/guaranteed fixnum. It does not. It binds n to nil initially, and (therefore?) omits the declaration.
Wow. You just sent me hunting for a bug that isn't. The behavior is explained on page 21 of the same iterate manual - I turned the page after lots of head scratching. Oh well, at least I know how iterate treats variables now (-:
The first paragraph on page 21 says you should use (declare (iterate:declare-variables)) somewhere in the top level of the iterate form to make it declare variables used in THE forms. If you want all your iterate forms to behave in this way, frob the variable iterate::*always-declare-variables* at compile time.
It might make sense to give the variable a useful binding, though. Sufficiently Smart Compilers might be grateful for that. I think I'll try and cook up a fix for this.
Cheers,
On 2004-10-30, rif@mit.edu wrote:
According to page 20 of the September 2004 version of the manual, I would expect
(iter (for (the fixnum n) in '(3 5 7 8 9)) (counting (oddp n)))
to expand into a form in which n was declared/guaranteed fixnum. It does not. It binds n to nil initially, and (therefore?) omits the declaration.
Wow. You just sent me hunting for a bug that isn't. The behavior is explained on page 21 of the same iterate manual - I turned the page after lots of head scratching. Oh well, at least I know how iterate treats variables now (-:
The first paragraph on page 21 says you should use (declare (iterate:declare-variables)) somewhere in the top level of the iterate form to make it declare variables used in THE forms. If you want all your iterate forms to behave in this way, frob the variable iterate::*always-declare-variables* at compile time.
It might make sense to give the variable a useful binding, though. Sufficiently Smart Compilers might be grateful for that. I think I'll try and cook up a fix for this.
Cheers,
Andreas Fuchs, asf@boinkor.net, asf@jabber.at, antifuchs
Ah, my mistake. Fair enough.
rif