Next: Records, Previous: Parameters, Up: Scheme reference [Contents][Index]
There are many mutable hashtable APIs amongst all the various Scheme
implementations, standards, and SRFIs. From our point of view, there
is no clear “best” hashtable API that has emerged, but we think the
R6RS interface is OK. Guile’s own hashtable API has design issues
that are best left in the past. So, the (hoot hashtables)
module is R6RS-like but with some notable differences.
Return a new, empty hashtable that uses the hash procedure hash and equivalence procedure equiv.
Return a new, empty hashtable that uses eq?
as the equivalence
function and hashes keys accordingly.
Return a new, empty hashtable that uses eqv?
as the equivalence
function and hashes keys accordingly.
Return #t
if obj
Return the hash function for table.
Return the equivalence function for table.
Return the current number of key/value pairs in table.
Return the value associated with key in table, or default if there is no such association.
Associate val with key in table, potentially overwriting any previous association with key.
Remove the association with key in table, if one exists.
Remove all of the key/value associations in table.
Return #t
if key has an associated value in table.
Return a copy of table.
Return a list of keys in table.
Return a list of values in table.
Apply proc to each key/value association in table. Each
call is of the form (proc key value)
.
Accumulate a result by applying proc with each key/value
association in table and the result of the previous proc
call. Each call is of the form (proc key value prev)
. For the
first call, prev
is the initial value init.
Hoot also includes weak key hash tables that wrap those of the Wasm
host platform, such as the WeakMap
JavaScript class on the web.
Return a new weak key hashtable.
Return #t
if obj is a weak key hashtable.
Return the value associated with key in hashtable or default if there is no such association.
Modify hashtable to associate key with value, overwriting any previous association that may have existed.
Remove the association with key in hashtable, if one exists.
The following hash functions are available:
Return a hash value for key suitable for using in a table containing size buckets. The returned hash value will be in the range [0, size).
hashq
is the hash function used by make-eq-hashtable
,
and hashv
is used by make-eqv-hashtable
.
Next: Records, Previous: Parameters, Up: Scheme reference [Contents][Index]