hash-table-update!/default

The UPDATE-FUNCTION takes the existing VALUE for KEY and returns the new VALUE.

The DEFAULT-VALUE is used when the entry for KEY is missing.

Returns the new VALUE.

hash-table-copy

[procedure](hash-table-copy HASH-TABLE)

Returns a shallow copy of the HASH-TABLE.

hash-table-delete!

[procedure](hash-table-delete! HASH-TABLE KEY)

Deletes the entry for KEY in the HASH-TABLE.

hash-table-remove!

[procedure](hash-table-remove! HASH-TABLE PROC)

Calls PROC for all entries in HASH-TABLE with the key and value of each entry. If PROC returns true, then that entry is removed.

hash-table-clear!

[procedure](hash-table-clear! HASH-TABLE)

Deletes all entries in HASH-TABLE.

hash-table-merge

[procedure](hash-table-merge HASH-TABLE-1 HASH-TABLE-2)

Returns a new HASH-TABLE with the union of HASH-TABLE-1 and HASH-TABLE-2.

hash-table-merge!

[procedure](hash-table-merge! HASH-TABLE-1 HASH-TABLE-2)

Returns HASH-TABLE-1 as the union of HASH-TABLE-1 and HASH-TABLE-2.

hash-table-map

[procedure](hash-table-map HASH-TABLE FUNC)

Calls FUNC for all entries in HASH-TABLE with the key and value of each entry.

Returns a list of the results of each call.

hash-table-fold

[procedure](hash-table-fold HASH-TABLE FUNC INIT)

Calls FUNC for all entries in HASH-TABLE with the key and value of each entry, and the current folded value. The initial folded value is INIT.

Returns the final folded value.

hash-table-for-each

[procedure](hash-table-for-each HASH-TABLE PROC)

Calls PROC for all entries in HASH-TABLE with the key and value of each entry.

hash-table-walk

[procedure](hash-table-walk HASH-TABLE PROC)

Calls PROC for all entries in HASH-TABLE with the key and value of each entry.

Hashing Functions

All hash functions return a fixnum in the range [0 BOUND).

When given the fixnum RANDOMIZATION, these functions will use this to perturb the value; if not specified, the value will differ for each invocation of your program. This is for security reasons; an attacker who knows what a value hashes to can deliberately try to cause collisions, thereby flattening your hash table, effectively reducing it to a list. Always make sure you don't expose any hashed value to an attacker.

number-hash

[procedure](number-hash NUMBER [BOUND RANDOMIZATION])

For use with = as a hash-table-equivalence-function.

object-uid-hash

[procedure](object-uid-hash OBJECT [BOUND RANDOMIZATION])

Currently a synonym for equal?-hash.

symbol-hash

[procedure](symbol-hash SYMBOL [BOUND RANDOMIZATION])

For use with eq? as a hash-table-equivalence-function.

keyword-hash

[procedure](keyword-hash KEYWORD [BOUND RANDOMIZATION])

For use with eq? as a hash-table-equivalence-function.

string-hash

[procedure](string-hash STRING [BOUND START END RANDOMIZATION])

For use with string=? as a hash-table-equivalence-function. The optional START and END arguments may be given to limit the hash calculation to a specific sub-section of STRING.