Previously and Initially disagree with documentation

Bug #1010495 reported by Patrick Stein
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
ITERATE macro
New
Undecided
Unassigned

Bug Description

From the iterate website: http://common-lisp.net/project/iterate/bugs.html
===========================================
 (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.
===========================================

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.