5.5 Generic Function hash-value

Similarly to compare, FSet has a default hash function for use by the CHAMP collections, hash-value. FSet predefines hash-value methods on the same built-in Common Lisp types as for compare: null, real, complex, character, symbol, string, list, vector, array, sequence, class, pathname, and package.

The hash-value method on strings currently just calls sxhash, which in most Lisp implementations hashes the entire string, taking time linear in its length. I expect most implementations have optimized this process well in a constant-factor sense, so it’s unlikely to be a problem unless your strings are huge. But if they are, you might want to use a bounded-length string hash (see below).

The hash-value methods on lists, vectors, and arrays do bounded hashing, as do those on the WB collections. Hash values on CHAMP collections are cached.

Like compare, hash-value makes no attempt to detect circularities in the structures it is hashing.