- make-sfht:procedure
where
- MAKE-RNG-STATE
- is a user-supplied function that takes in an integer argument and returns an RNG state value.
- RANDOM!
- is a user-supplied function that generates a random positive integer, given a state value, which is expected to be mutated.
- KEY->VECTOR
- is a user-supplied function that takes a key value and returns a vector.
- KEY-VECTOR-REF
- is a user-supplied function that retrieves an element from the vector returned by KEY-VECTOR.
- KEY-VECTOR-LENGTH
- is a user-supplied function that returns the length of the key vector.
- KEY->EQUAL?
- is a user-supplied predicate that takes two keys and returns #t if they are equal. The default function used is equal?
The SFHT typeclass consists of the following methods:
- empty
- creates a new empty hash table
- get
- procedure of the form SFHT KEY . DEFAULT-CLAUSE which searches the hash table for an association with a given KEY, and returns a (key . value) pair of the found association. If an association with KEY cannot be located in the hash table, the PROC returns the result of evaluating the DEFAULT-CLAUSE. If the default clause is omitted, an error is signaled. KEY must be comparable to the keys in the hash table by the KEY-EQUAL? predicate specified when the hash table was created)
- empty?
- returns #t if the hash table is empty
- size
- returns the size (the number of associations) in the hash table
- clear!
- removes all associations from the hash table (thus making it empty)
- put!
- procedure of the form SFHT KEY VALUE which, given a KEY and a VALUE, adds the corresponding association to the hash table. If an association with the same KEY already exists, its value is replaced with the VALUE. The return value is #f.
- delete!
- procedure of the form SFHT KEY . DEFAULT-CLAUSE which searches the hash table for an association with a given KEY, deletes it, and returns a (key . value) pair of the found and deleted association. If an association with the KEY cannot be located in the hash table, the PROC returns the result of evaluating DEFAULT-CLAUSE. If the default clause is omitted, an error is signaled.