Module type HashCons.S

module type S = sig .. end
The module for hash-consing tables. The main function is of course hashcons, but to implement efficient functions on the DAGs that result, you also need caches, and those caches must also be weak or you'll need to clean them very often and possibly lose some of the advantages of memoisation. Therefore this module allows to get basic caches (1-ary function, 2-ary and 2-ary on data + other value) and then manages them, i.e. cleans them when a cleaning cycle starts.

type data 
type t 
val create : int -> t
Create a new hash-consing table of the given size.
val clear : t -> unit
Clear the given hash-consing table.
val hashcons : ?log:bool -> t -> data -> data HashCons.hc
Hashcons a value. If set, it logs statistics during cleaning cycle.
module H1: Hashtbl.S  with type key = data hc
Hashtables with consed data as key (very efficient hashing).
module H2: Hashtbl.S  with type key = data hc * data hc
Hashtables with pairs of consed data as key (very efficient hashing).
type other_value 
module HV: Hashtbl.S  with type key = data hc * other_value
Hashtables with pairs of consed data and other value as key.
val get_h1 : t -> data HashCons.hc H1.t
Get a managed (data, data) cache.
val get_h2 : t -> data HashCons.hc H2.t
Get a managed (data * data, data) cache.
val get_hv : t -> data HashCons.hc HV.t
Get a managed (data * data, other_value) cache.
val get_h1_alpha : (module HashCons.Type with type t = 'a) -> t -> 'a H1.t
Get a managed (data, 'a) cache. Uses Type module for existential 'a.