[racket] empty hash tables

From: Marijn (hkBst at gentoo.org)
Date: Mon May 30 09:59:47 EDT 2011

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 05/30/11 15:00, Matthew Flatt wrote:
> How would `hash-empty?' be different than `hash-count' for a weak hash
> table? A traversal of the table is needed to check whether any keys
> have disappeared.

But as soon as an non-disappeared key has been found `hash-empty?' could
return without needing to traverse the rest of the table.

> That is, I don't see how to make `hash-empty?' on a
> weak table a constant-time operation without additional GC support.

It might not be possible to make `hash-empty?' a constant-time
operation, but in a big table the difference between traversing until
the first non-disappeared key and traversing the complete table would
still be significant, wouldn't it?

Marijn

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.17 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk3jotMACgkQp/VmCx0OL2wqcgCgoS6P8HXcR5hIUI9bZpg79mqr
N2wAmwZ2p0uaLI8XjmYGb8zvaw8FSdbh
=Q4Wm
-----END PGP SIGNATURE-----


Posted on the users mailing list.