containers
A modular, clean and powerful extension of the OCaml standard library
1024" x-on:close-sidebar="sidebar=window.innerWidth > 1024 && true">
back to documentation root
ON THIS PAGE
Legend:
Library
Module
Module type
Parameter
Class
Class type
Library
Module
Module type
Parameter
Class
Class type
Library containers
Definitions
type 'a t = 'a -> hash
A hash function for values of type 'a
.
val const0 : _ t
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)
.
val int : int t
val bool : bool t
val char : char t
val int32 : int32 t
val int64 : int64 t
val nativeint : nativeint t
val slice : string -> int -> int t
slice s i len state
hashes the slice i, …, i+len-1
of s
into state
.
val bytes : bytes t
Hash a byte array.
val string : string t
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)
val poly : 'a t
poly x
is Hashtbl.hash x
. The regular polymorphic hash function.
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.