Gisle S�lensminde:
> When I use the loop macro to itterate over the values or keys of a hash
> table together with the collect keyword, I can only use one expression
> in the body.
> If i use do instead of collect, or wraps the expressions in a progn,
> everything works fine. It also works fine if I use do instead of collect,
> but the same error occurs when I use sum.
>
> Is this a bug in the loop macro implementation in CMUCL or is it incorrect
> usage of the loop macro (or both :-)

The LOOP syntax is defined that way. Besides, the meaning of `collect
(foo) (bar)' is ambiguous: which of the two return values do you really
want to collect?

Take a look at the CLHS entry for this macro, and you'll find `do' takes
`compound-form+' while `collect' takes `form'.

In the example, to collect both return values, use two collect statements;
to collect only one, use prog1 or progn.

- Willem


Reply via email to