package containers
Install
dune-project
Dependency
Authors
Maintainers
Sources
sha256=52eeff91ce42b52305e6aaa8a58b88ce8f0a5a984199e59ca7e2fd9ebabe61d7
sha512=dc7337e6cbc9850542c7c9228d3bcb4e4add57a55e2a2992f21fb4761b3e10a68ef1d57ca37a7f5b303fc875fe3df5ecb69dbf2930bfcd1561ce03f7ae83e24b
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.