Getting hashes of any type of object in Common Lisp

I am trying to implement some data structures (e.g. a HAMP hash array matched by trie) in Common Lisp, and I need to get 32- or 64-bit hashes of the objects that I want to store in these data structures.

I know that I can put objects in shared Lisp hash tables (created using (make-hash-table) ), but I could not find a way to get the hash of the object, like Java hashCode or Python hash . Does Common Lisp have such a function? If not, how does the standard CL hash table generate hashes from arbitrary object types?

+4
source share
1 answer

The sxhash function returns a hash for its argument. Details: sxhash .

 * (sxhash 'fred) 4287909749829334992 * (sxhash 'joe) 23906557261513707 * (sxhash 'fred) 4287909749829334992 
+6
source

Source: https://habr.com/ru/post/1388574/


All Articles