package containers

  1. Overview
  2. Docs
Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source

Module CCHashSource

Hash combinators

Definitions

Sourcetype hash = int

A hash value is a positive integer.

Sourcetype 'a t = 'a -> hash

A hash function for values of type 'a.

Sourceval const : hash -> _ t

const h hashes any value into h. Use with caution!.

Sourceval 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).

  • since 1.5
Sourceval int : int t
Sourceval bool : bool t
Sourceval char : char t
Sourceval int32 : int32 t
Sourceval int64 : int64 t
Sourceval nativeint : nativeint t
Sourceval slice : string -> int -> int t

slice s i len state hashes the slice i, …, i+len-1 of s into state.

Sourceval string : string t
Sourceval list : 'a t -> 'a list t
Sourceval array : 'a t -> 'a array t
Sourceval opt : 'a t -> 'a option t
Sourceval pair : 'a t -> 'b t -> ('a * 'b) t
Sourceval triple : 'a t -> 'b t -> 'c t -> ('a * 'b * 'c) t
Sourceval quad : 'a t -> 'b t -> 'c t -> 'd t -> ('a * 'b * 'c * 'd) t
Sourceval if_ : bool -> 'a t -> 'a t -> 'a t

Decide which hash function to use depending on the boolean.

Sourceval poly : 'a t

poly x is Hashtbl.hash x. The regular polymorphic hash function.

Sourceval list_comm : 'a t -> 'a list t

Commutative version of list. Lists that are equal up to permutation will have the same hash.

  • since 1.0
Sourceval array_comm : 'a t -> 'a array t

Commutative version of array. Arrays that are equal up to permutation will have the same hash.

  • since 1.0

Base hash combinators

Sourceval combine : 'a t -> hash -> 'a -> hash
Sourceval combine2 : hash -> hash -> hash
Sourceval combine3 : hash -> hash -> hash -> hash
Sourceval combine4 : hash -> hash -> hash -> hash -> hash
Sourceval combine5 : hash -> hash -> hash -> hash -> hash -> hash
  • since 2.1
Sourceval combine6 : hash -> hash -> hash -> hash -> hash -> hash -> hash
  • since 2.1

Iterators

Sourcetype 'a iter = ('a -> unit) -> unit
Sourcetype 'a gen = unit -> 'a option
Sourceval seq : 'a t -> 'a Seq.t t
Sourceval iter : 'a t -> 'a iter t
Sourceval gen : 'a t -> 'a gen t
OCaml

Innovation. Community. Security.