Subject: loop macro, "for across" expansion fails

From: Lauri Siponen <[email-masked]>
Date: Wed, 1 Feb 1995 10:13:33 +0200

Hello everyone,

Loop macro expander fails when a "for across" construct
is followed by other iteration constucts. The following
examples demonstrate the bug. The first three ones
give correct results, but the fourth one fails.

> (loop for a in '(a b c) collect a)
(A B C)

> (loop for a in '(a b c) for b in '(1 2 3) collect a collect b)
(A 1 B 2 C 3)

> (loop for a across "abc" collect a)
(#\a #\b #\c)

> (loop for a across "abc" for b across "123" collect a collect b)

*** - AREF: index 3 for "abc" is out of range
1. Break> 

> (lisp-implementation-version)
"1995-01-01 (January 1995)"

> (machine-version)
"SUN4M"

Is there a fix available for this bug?

Lauri Siponen

---

From: haible (Bruno Haible)
Date: Thu, 2 Feb 95 14:44:31 +0100

Lauri Siponen <[email-masked]> writes:

> is followed by other iteration constucts.

This is a bug in CLISP and will be fixed in the next release,

> *** - AREF: index 3 for "abc" is out of range

As a temporary workaround, you can join the FOR clauses using AND.
(loop for a across "abc" and for b across "123" collect a collect b)

                    Bruno Haible
                    [email-masked]