#585 loop mixing with & hash table for

closed-fixed
Sam Steingold
clisp (525)
5
2011-03-28
2011-01-25
Don Cohen
No

[I guess this is an ansi compliance issue?]
(setf ht (make-hash-table))
(setf (gethash 1 ht) 2)
(loop for k being the hash-keys of ht as v being the
hash-values of ht with ut = 3 count t)
0
I think the answer should be 1, as below
(loop with ut = 3 for k being the hash-keys of ht as v
being the hash-values of ht count t)
1
(loop for k being the hash-keys of ht with ut = 3 as v
being the hash-values of ht count t)
1

Discussion

  • Sam Steingold
    Sam Steingold
    2011-03-25

    this is, of course, a bug;
    note that the more efficient version of the same loop is
    (loop with ut = 3 for k being the hash-keys of ht using (hash-values v) count t)

     
  • Sam Steingold
    Sam Steingold
    2011-03-28

    thank you for your bug report.
    the bug has been fixed in the source tree (mercurial/hg).
    you can either wait for the next release (recommended)
    or check out the current mercurial tree (see http://clisp.org\)
    and build CLISP from the sources (be advised that between
    releases the source tree is very unstable and may not even build
    on your platform).

     
  • Sam Steingold
    Sam Steingold
    2011-03-28

    • assigned_to: haible --> sds
    • summary: loop expansion --> loop mixing with & hash table for
    • status: open --> closed-fixed