[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
emptying an hashtable
RFC-822-Headers:
Received: from eldi.epfl.ch by SIC.Epfl.CH with VMSmail ; Thu, 31 May 90 08:51:56 N
X-ST-Vmsmail-To: @DIS:SLUG
==================
I use a lot of hashtables having the form described below:
(defvar *a-table*
(make-hash-table :test #'equal
:rehash-threshold 0.8
:rehash-size 2.0
:size 100))
When I have to empty them, I use the following function:
(defun reset-hashtable (table)
(maphash #'(lambda (key value)
(declare (ignore value))
(remhash key table))
table))
Both declarations correspond to the description in the chapter 16 of ClTl,
and everything works well.
But, I had another slightly different table:
(defvar *another-table*
(make-hash-table :test #'eq ; instead of EQUAL
:rehash-threshold 0.8
:rehash-size 2.0
:size 100))
>From the CLtl, EQ is also usable. But, When I tried to empty *another-table*,
only one element was removed. I had to recreate it with the test being EQUAL
so that my procedure worked.
Is this a bug (maybe known) or did I misunderstand something?
Emmanuel Baechler baechler@elma.epfl.ch
AI LAB
Swiss Federal Institute of Technology at Lausanne