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 :-)

* (defparameter *hash* (make-hash-table))

*HASH*
* (setf (gethash 'a *hash*) 1)

1
* (setf (gethash 'b *hash*) 2)

2

* (loop for val being the hash-values of *hash* collect
     (format t "The value is ~a~%" val)
     (list val))



(LIST VAL) found where a LOOP keyword or LOOP type keyword expected.
Current LOOP context: COLLECT (FORMAT T "The value is ~a~%" VAL) (LIST VAL).
    [Condition of type KERNEL:SIMPLE-PROGRAM-ERROR]

Restarts:
   0: [ABORT] Return to Top-Level.

Debug  (type H for help)

(ANSI-LOOP::LOOP-OPTIONAL-TYPE NIL)
Source: Error finding source:
Error in function DEBUG::GET-FILE-TOP-LEVEL-FORM:  Source file no longer exists:
   target:code/loop.lisp.

0] abort

* (loop for val being the hash-values of *hash* do
     (format t "The value is ~a~%" val)
     (list val))
The value is 1
The value is 2
NIL


-- 
Gisle S�lensminde, Phd student, Scientific programmer
Computational biology unit, University of Bergen, Norway
Email: [EMAIL PROTECTED] | Complicated is easy, simple is hard.


Reply via email to