Previously and Initially disagree with documentation
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
ITERATE macro |
New
|
Undecided
|
Unassigned |
Bug Description
From the iterate website: http://
=======
(iter (for el in '(1 2 3 4))
(for p-el previous el)
(for pp-el previous p-el initially 0)
(collect pp-el))
gives (0 NIL 1 2); should be (0 0 1 2) according to the manual. I suspect it's a doc bug. Found by Carlos Ungil.
(iter (for el in '(1 2 3 4))
(for pp-el previous el back 2 initially 0)
(collect pp-el))
gives the right result.
So does:
(iter (for el in '(1 2 3 4))
(for p-el previous el initially 0)
(for pp-el previous p-el initially 0)
(collect pp-el))
Without an INITIALLY 0, p-el gets set to NIL the first time through the loop. So, pp-el's value is NIL the second time through the loop. The for...previous documentation talks about the "first" and "second" value. But it doesn't detail if the initial value counts as a "first" value.
=======