chicken-users
[Top][All Lists]
Advanced

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

[Chicken-users] hash-table-walk + hash-table-delete!


From: Graham Fawcett
Subject: [Chicken-users] hash-table-walk + hash-table-delete!
Date: Mon, 5 Mar 2007 10:37:15 -0500

Hi folks,

Is it safe to delete keys hash-table from within a hash-table-walk
procedure? E.g.

(hash-table-walk my-hash-table
                 (lambda (k v)
                   (when (bad? v)
                         (hash-table-delete! my-hash-table k))))

If I'm reading the implementation correctly, it's safe, since a
deletion does not change the length of the storage vector, and the
tail of the current bucket-list (after the deleted item) is preserved
--- meaning that the iteration over the vector will not be
compromised, and neither will the iteration over any bucket-list.

Still, I thought I might get a second opinion. :-)

Thanks,
Graham




reply via email to

[Prev in Thread] Current Thread [Next in Thread]