Skip to content

pnathan/genhash

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

NET.HEXAPODIA.HASHTABLES

Generic hash table implementation. This implementation is in the
public domain.

Written by Ingvar Mattsson <ingvar@hexapodia.net>.

This package defines four generic functions and two normal functions.
The non-generic function MAKE-GENERIC-HASH-TABLE is used for
hash table creation.
	(make-generic-hashtable (:test 'eql) (:size 17))
    If this function is fed the *symbols* EQ EQL EQUAL or EQUALP as test
    it will create a generic hash table with that as an equality test
    and SXHASH as the hash function. NOTE: Using EQ or EQL as the test
    designator is risky and should be avoided. In general, for the
    built-in test designators, use the function instead of the
    symbol. This will give you a built-in hash table.

    If this function is fed the *functions* EQ EQL EQUAL or EQUALP
    it will create a normal (built-in) hash table with that as a test
    function.

	(register-test-designator <nickname> <hash fn> <equal fn>)
    Register a new generic hash function with <nickname> as the
    relevant :test parameter.

The generic functions are:
	(hashref <key> <table> &optnonal (default nil))
    This function does essentially the same thing as GETHASH.

	((setf hashref) <value> <key> <table> &optional ignore)
    For (setf (hashref ...) ...)

	(map-generic-hash <fn> <table>)
    As MAPHASH

	(hashrem <key> <table>)
    As REMHASH

These functions dispatch somewhat differently depending on if they're
fed a generic hash table or a built-in hash table.


For benchmarking, just load "benchtests.lisp", this will loop through
the number 0 to 1000 (and 100000) and feed them into a hash table, then
generating a report of *STANDARD-OUTPUT*.