Module type S
= sigend
The output signature of the functor Weak.Make .
typedata
The type of the elements stored in the table.
typet
The type of tables that contain elements of type data . Note that weak hash sets cannot be marshaled
using output_value or the functions of the Marshal module.
valcreate : int->tcreaten creates a new empty weak hash set, of initial size n . The table will grow as needed.
valclear : t->unit
Remove all elements from the table.
valmerge : t->data->datamergetx returns an instance of x found in t if any, or else adds x to t and return x .
valadd : t->data->unitaddtx adds x to t . If there is already an instance of x in t , it is unspecified which one will be
returned by subsequent calls to find and merge .
valremove : t->data->unitremovetx removes from t one instance of x . Does nothing if there is no instance of x in t .
valfind : t->data->datafindtx returns an instance of x found in t .
RaisesNot_found if there is no such element.
valfind_opt : t->data->dataoptionfind_opttx returns an instance of x found in t or None if there is no such element.
Since 4.05
valfind_all : t->data->datalistfind_alltx returns a list of all the instances of x found in t .
valmem : t->data->boolmemtx returns true if there is at least one instance of x in t , false otherwise.
valiter : (data->unit)->t->unititerft calls f on each element of t , in some unspecified order. It is not specified what happens if f
tries to change t itself.
valfold : (data->'acc->'acc)->t->'acc->'accfoldftinit computes (fd1(...(fdNinit))) where d1...dN are the elements of t in some unspecified
order. It is not specified what happens if f tries to change t itself.
valcount : t->int
Count the number of elements in the table. countt gives the same result as fold(fun_n->n+1)t0
but does not delay the deallocation of the dead elements.
valstats : 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.
OCamldoc 2025-06-12 Weak.S(3o)