common-lisp Creating a hash table


Hash tables are created by make-hash-table:

(defvar *my-table* (make-hash-table))

The function may take keyword parameters to further specify the behavior of the resulting hash table:

  • test: Selects the function used to compare keys for equality. Maybe a designator for one of the functions eq, eql, equal or equalp. The default is eq.
  • size: A hint to the implementation about the space that may initially be required.
  • rehash-size: If an integer (>= 1), then when doing a rehash, the hash table will increase its capacity by the specified number. If otherwise an float (> 1.0), then the hash table will increase its capacity to the product of the rehash-size and the previous capacity.
  • rehash-threshold: Specifies how full the hash table has to be in order to trigger a rehash.