Create and answer a new hash table with equal-proc as the equality function and hash-proc as the hashing function.
By default, equal-proc is
equal?. It can be any two-argument procedure, and should answer whether two keys are the same for this table's purposes.
My default hash-proc assumes that
equal-procis no coarser than
equal?unless it is literally
string-ci=?. If provided, hash-proc should be a two-argument procedure that takes a key and the current table size, and answers a reasonably good hash integer between 0 (inclusive) and the size (exclusive).
weakness should be
#for a symbol indicating how “weak” the hash table is:
- An ordinary non-weak hash table. This is the default.
- When the key has no more non-weak references at GC, remove that entry.
- When the value has no more non-weak references at GC, remove that entry.
- When either has no more non-weak references at GC, remove the association.
As a legacy of the time when Guile couldn't grow hash tables, start-size is an optional integer argument that specifies the approximate starting size for the hash table, which will be rounded to an algorithmically-sounder number.
By coarser than
equal?, we mean that for all x and
y values where
(equal-proc x y
(equal? x y
) as well. If that does not hold for
your equal-proc, you must provide a hash-proc.
In the case of weak tables, remember that references above
always refers to
eq?-wise references. Just because you have a
reference to some string
"foo" doesn't mean that an association
"foo" in a weak-key table won't be collected;
it only counts as a reference if the two
regardless of equal-proc. As such, it is usually only sensible
hashq as the equivalence and hash
functions for a weak table. See Weak References, for more
information on Guile's built-in weak table support.