The HASHKEY signature

« 210 Library Documentation

Overview

The HASHKEY signature defines an abstract key type which supports equality, is totally ordered, and additionally offers a pseudo-random hashing operation. Any structure which ascribes to HASHKEY also implicitly ascribes to both ORDKEY and EQKEY.

Interface

type t

val equal : t * t → bool
val compare : t * t → order
val hash : t → int
val toString : t → string

Types

type t
The abstract key type.

Values

val equal : t * t → bool
Determine whether or not the arguments are considered equal. This function is reflexive, symmetric, and transitive.
val compare : t * t → order
Return one of LESS, EQUAL, or GREATER as appropriate for the argument pair. This operation is transitive. It is also consistent: compare (x, y) = EQUAL if and only if equal (x, y), and compare (x, y) = LESS if and only if compare (y, x) = GREATER.
val hash : t → int
Return a pseudo-random hash.
val toString : t → string
Return a string representation of the key.