[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

hash-values loop keyword



>Date: Wed, 22 Apr 1992 09:00 EST
>From: SHAPIRO%RCSMPB@gmr.com
>To: info-macl@cambridge.apple.com
>
>MCL 2.0b1 seems to have a problem with the following loop construct.
>In particular it does not seem to recognize HASH-VALUES as the loop keywords.
>
>
>(setf ht (make-hash-table))
>(loop for i below 100 do
>  (setf (gethash i ht) (random 10.0)))
>(loop for value being the hash-values of ht
>      minimize value into min
>      maximize value into max
>      finally return (list min max))
>
>

This has been fixed since MCL2.0b1 - it works in the final release.
All you have to change is to put some extra parens around
RETURN because we're not using it as a LOOP keyword.

(loop for value being the hash-values of ht
      minimize value into min
      maximize value into max
      finally (return (list min max)))

By the way, if you love loop macros, there's six different kinds to
choose from (mit-loop, cmu-loop, sloop, yloop, iterate, and series), 
available by anonymous ftp from Mark Kantrowitz's cl-utilities archive.

Hostname: a.gp.cs.cmu.edu [128.2.242.7]
cd path:  /usr/mkant/Public