package containers
Install
dune-project
Dependency
Authors
Maintainers
Sources
sha256=0f70824867269c02bf01ae12206aa47a6f669d69f1954c19e68ece9f444f1cba
sha512=11de2d7b7173659e6b83c487ac116a93d4b780b86da07386e7604f8fd45f6841e93cba59dba59ed7dbf6e1bc26561202ae1d2e7238a12f588dfd557d4f2da589
doc/containers/CCHash/index.html
Module CCHashSource
Hash combinators
The API of this module is stable as per semantic versioning, like the rest of containers. However the exact implementation of hashing function can change and should not be relied on (i.e. hashing a value always returns the same integer within a run of a program, not across versions of OCaml and Containers).
Definitions
A hash value is a positive integer.
Always return 0. Useful for ignoring elements. Example: Hash.(pair string const0) will map pairs ("a", 1) and ("a", 2) to the same hash, but not the same as ("b", 1).
slice s i len state hashes the slice i, …, i+len-1 of s into state.
map f h is the hasher that takes x, and uses h to hash f x.
For example:
module Str_set = Set.Make(String)
let hash_str_set : Str_set.t CCHash.t = CCHash.(map Str_set.to_seq @@ seq string)Decide which hash function to use depending on the boolean.
Commutative version of list. Lists that are equal up to permutation will have the same hash.
Commutative version of array. Arrays that are equal up to permutation will have the same hash.