package hashcons

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

Module HashconsSource

Sourcetype +'a hash_consed = private {
  1. hkey : int;
  2. tag : int;
  3. node : 'a;
}
Sourcetype 'a t
Sourceval create : int -> 'a t

create n creates an empty table of initial size n. The table will grow as needed.

Sourceval clear : 'a t -> unit

Removes all elements from the table.

Sourceval hashcons : 'a t -> 'a -> 'a hash_consed

hashcons t n hash-cons the value n using table t i.e. returns any existing value in t equal to n, if any; otherwise, allocates a new one hash-consed value of node n and returns it. As a consequence the returned value is physically equal to any equal value already hash-consed using table t.

Sourceval iter : ('a hash_consed -> unit) -> 'a t -> unit

iter f t iterates f over all elements of t.

Sourceval stats : 'a t -> int * int * int * int * int * int

Return statistics on the table. The numbers are, in order: table length, number of entries, sum of bucket lengths, smallest bucket length, median bucket length, biggest bucket length.

Sourcemodule type HashedType = sig ... end
Sourcemodule type S = sig ... end
Sourcemodule Make (H : HashedType) : S with type key = H.t
Sourcemodule Hmap : sig ... end
Sourcemodule Hset : sig ... end