LOOP destructuring incorrectly signals error
Describe the bug
Destructuring in loops is incorrect
To Reproduce
Steps to reproduce the behavior:
Run this test from ansi-test loop.8.26
(LOOP WITH (A B . REST) = '(1)
FOR (C D) = '(2)
DO (RETURN (VALUES A B C D REST)))
We get an error:
Error while parsing arguments to DESTRUCTURING-BIND in LISP::DO-ARG-COUNT-ERROR:
Invalid number of elements in:
(1)
to satisfy lambda-list:
(A B &REST REST)
Expected at least 2, but got 1.
Expected behavior
This loop should work and return 5 values:
1
NIL
2
NIL
NIL
This happens because the LOOP
macro uses DESTRUCTURING-BIND
to
implement the destructuring. But I think this is wrong; LOOP
needs
its own destructuring to handle what LOOP
wants.