From: Raymond T. <to...@rt...> - 2000-02-22 22:16:53
|
Here's some code the I think CLISP incorrectly compiles: (cl:defun split-assignment (args) (loop for d in args by #'cddr as b on args by #'cddr collect d into vars when (not (null (cdr b))) collect (cadr b) into binds finally (return (values vars b binds)))) (split-assignment '(a 1 b 2 c 3)) should return (A B C) (C 3) (1 2 3) On compiling this, CLISP complains that B is an unknown variable and assumes it's special. It works fine on CMUCL and LWW. Note: this is not my code, and I'm going to replace this with an equivalent do loop, but I thought I'd report this anyway. Ray |
From: Sam S. <sd...@gn...> - 2000-02-23 00:09:47
|
I am not sure one is allowed to assume that the loop local variables still exist in the `finally' clause. convince me otherwise and I will try to fix this. >>>> In message <145...@rt...> >>>> On the subject of "loop bug" >>>> Sent on Tue Feb 22 17:16:14 EST 2000 >>>> Honorable Raymond Toy <to...@rt...> writes: >> Here's some code the I think CLISP incorrectly compiles: >> >> (cl:defun split-assignment (args) >> (loop for d in args by #'cddr as b on args by #'cddr >> collect d into vars >> when (not (null (cdr b))) >> collect (cadr b) into binds >> finally (return (values vars b binds)))) >> >> (split-assignment '(a 1 b 2 c 3)) should return >> >> (A B C) >> (C 3) >> (1 2 3) >> >> On compiling this, CLISP complains that B is an unknown variable and >> assumes it's special. It works fine on CMUCL and LWW. >> >> Note: this is not my code, and I'm going to replace this with an >> equivalent do loop, but I thought I'd report this anyway. -- Sam Steingold (http://www.podval.org/~sds) Micros**t is not the answer. Micros**t is a question, and the answer is Linux, (http://www.linux.org) the choice of the GNU (http://www.gnu.org) generation. Don't hit a man when he's down -- kick him; it's easier. |
From: Raymond T. <to...@rt...> - 2000-02-23 13:45:49
|
>>>>> "Sam" == Sam Steingold <sd...@gn...> writes: Sam> I am not sure one is allowed to assume that the loop local Sam> variables still exist in the `finally' clause. convince me Sam> otherwise and I will try to fix this. Good point. I don't really know the answer to this. I looked through the CLHS but didn't find any comments on what is or is not allowed in a FINALLY clause. However, the very first example I looked at in CLtL2 has this example where a loop local variable is in the FINALLY clause: (loop for i from 1 to 10 when (> i 5) collect i finally (print i)) which should print 11 and return the list '(6 7 8 9 10). Is that enough? In any case, as I mentioned, I'm replacing this code with an equivalent do loop because this loop is just too hard for me to understand. Ray |
From: Sam S. <sd...@gn...> - 2000-02-23 15:45:10
|
>>>> In message <145...@rt...> >>>> On the subject of "Re: loop bug" >>>> Sent on Wed Feb 23 08:44:57 EST 2000 >>>> Honorable Raymond Toy <to...@rt...> writes: >> >> However, the very first example I looked at in CLtL2 has this example >> where a loop local variable is in the FINALLY clause: >> >> (loop for i from 1 to 10 >> when (> i 5) >> collect i >> finally (print i)) >> >> which should print 11 and return the list '(6 7 8 9 10). this works in clisp just fine. I shall try to investigate. thanks for the bug report. -- Sam Steingold (http://www.podval.org/~sds) Micros**t is not the answer. Micros**t is a question, and the answer is Linux, (http://www.linux.org) the choice of the GNU (http://www.gnu.org) generation. If it has syntax, it isn't user friendly. |
From: <no...@so...> - 2001-05-04 22:47:51
|
Bugs item #421520, was updated on 2001-05-04 15:47 You can respond by visiting: http://sourceforge.net/tracker/?func=detail&atid=101355&aid=421520&group_id=1355 Category: None Group: None Status: Open Resolution: None Priority: 5 Submitted By: Sam Steingold (sds) Assigned to: Nobody/Anonymous (nobody) Summary: loop bug Initial Comment: (LET ((STACK (COPY-LIST '(A B C D E F)))) (LOOP WHILE STACK FOR ITEM = (LENGTH STACK) THEN (POP STACK) COLLECT ITEM)) should return (6 A B C D E F) but in CLISP it returns (6 A B C D E) ---------------------------------------------------------------------- You can respond by visiting: http://sourceforge.net/tracker/?func=detail&atid=101355&aid=421520&group_id=1355 |