From: Wolfhard Buß
Subject: loop over the hash
Date: 
Message-ID: <m3hey2wqz0.fsf@buss-14250.user.cis.dfn.de>
Simple question:

Does the standard guarantee the equivalence of

 (loop for k being the hash-keys   of h
       for v being the hash-values of h . <rest>)

and

 (loop for k being the hash-keys of h using (hash-value v) . <rest>)?


-wb

From: Tim Moore
Subject: Re: loop over the hash
Date: 
Message-ID: <9f3ktn$1df$0@216.39.145.192>
On 30 May 2001, Wolfhard [iso-8859-1] Buß wrote:

> Simple question:
> 
> Does the standard guarantee the equivalence of
> 
>  (loop for k being the hash-keys   of h
>        for v being the hash-values of h . <rest>)
> 
> and
> 
>  (loop for k being the hash-keys of h using (hash-value v) . <rest>)?

Nope.  From 6.1.2.1.6, The for-as-hash subclause:

These loop keywords access each key entry of the hash table. If the name
hash-value is supplied in a using  construct with one of these Loop
schemas, the iteration can optionally access the keyed value. The order in
which the keys are accessed is undefined; empty slots in the hash table
are ignored.

Tim
From: Steven M. Haflich
Subject: Re: loop over the hash
Date: 
Message-ID: <3B15BCD7.6EC343AE@pacbell.net>
Tim Moore wrote:
> From 6.1.2.1.6, The for-as-hash subclause:
> 
> These loop keywords access each key entry of the hash table. If the name
> hash-value is supplied in a using  construct with one of these Loop
> schemas, the iteration can optionally access the keyed value. The order in
> which the keys are accessed is undefined; empty slots in the hash table
> are ignored.

Does it strike anyone besides me how disconnected and irrelevant is the
above clause about "empty slots", and indeed, the term "slot" itself?  This
is probably a leftover reference to an ancient hash implementation in
Maclisp or something.  I know of no such concepts elsewhere in the ANS.
From: Kent M Pitman
Subject: Re: loop over the hash
Date: 
Message-ID: <sfw4ru284ph.fsf@world.std.com>
"Steven M. Haflich" <·······@pacbell.net> writes:

> Tim Moore wrote:
> > From 6.1.2.1.6, The for-as-hash subclause:
> > 
> > These loop keywords access each key entry of the hash table. If the name
> > hash-value is supplied in a using  construct with one of these Loop
> > schemas, the iteration can optionally access the keyed value. The order in
> > which the keys are accessed is undefined; empty slots in the hash table
> > are ignored.
> 
> Does it strike anyone besides me how disconnected and irrelevant is the
> above clause about "empty slots", and indeed, the term "slot" itself?  This
> is probably a leftover reference to an ancient hash implementation in
> Maclisp or something.  I know of no such concepts elsewhere in the ANS.

Yeah, it appears to suggest an implementation of hash tables which is
only one of many possible implementations, too.  I'd be surprised no
one flagged this during the review process, but for the fact that
there was so much to review.