<div dir="ltr"><div><div>hY,<br><br></div>I have a feeling this is a bug.<br><span style="font-family:courier new,monospace"><br></span><div style="margin-left:40px"><span style="font-family:courier new,monospace">(defvar mylist '(:one :two :three))<br>
</span></div><span style="font-family:courier new,monospace"><br></span><div style="margin-left:40px"><span style="font-family:courier new,monospace">(iter (for var on mylist)<br> (collect (car var) into result)<br>
(finally (return (values result var))))<br>
(:ONE :TWO :THREE)<br>(:THREE)</span><br><br></div>I think var should be empty at the end, so the result would match the result of loop as<br><br><div style="margin-left:40px"><span style="font-family:courier new,monospace">(loop for var on mylist<br>
collect (car var) into result<br> finally (return (values result var)))<br>(:ONE :TWO :THREE)<br>NIL<br></span><br></div>The problem is caused by the end test code location.<br></div>The bold lines should appear in reverse order, I think.<br>
<div><br><div style="margin-left:40px"><span style="font-family:courier new,monospace">(macroexpand-1 '(iter (for var on mylist)<br> (collect (car var) into result)<br> (finally (return (values result var)))))<br>
(LET* ((#:LIST214 NIL)<br> (VAR NIL)<br> (RESULT NIL)<br> (#:END-POINTER215 NIL)<br> (#:TEMP216 NIL))<br> (BLOCK NIL<br> (TAGBODY<br> (PROGN (SETQ #:LIST214 MYLIST))<br> LOOP-TOP-NIL<br>
(PROGN<br><b> (IF (ATOM #:LIST214)<br> (GO LOOP-END-NIL))<br> (SETQ VAR #:LIST214)<br></b> (SETQ #:LIST214 (CDR #:LIST214))<br> (PROGN<br> (SETQ #:TEMP216 (LIST (CAR VAR)))<br>
(SETQ #:END-POINTER215<br> (IF RESULT<br> (SETF (CDR #:END-POINTER215) #:TEMP216)<br> (SETQ RESULT #:TEMP216)))<br> RESULT))<br> (PROGN)<br> (GO LOOP-TOP-NIL)<br>
LOOP-END-NIL<br> (PROGN (RETURN (VALUES RESULT VAR))))<br> NIL))</span><br></div>Best,<br></div><div>` bg`<br></div></div>