.TH "Weak.S" 3o source: 2019-01-25 OCamldoc "OCaml library" .SH NAME Weak.S \- The output signature of the functor Weak.Make. .SH Module type Module type Weak.S .SH Documentation .sp Module type .BI "S" = .B sig end .sp The output signature of the functor .B Weak\&.Make \&. .sp .sp .sp .I type data .sp The type of the elements stored in the table\&. .sp .I type t .sp The type of tables that contain elements of type .B data \&. Note that weak hash sets cannot be marshaled using .B Pervasives\&.output_value or the functions of the .B Marshal module\&. .sp .I val create : .B int -> t .sp .B create n creates a new empty weak hash set, of initial size .B n \&. The table will grow as needed\&. .sp .I val clear : .B t -> unit .sp Remove all elements from the table\&. .sp .I val merge : .B t -> data -> data .sp .B merge t x returns an instance of .B x found in .B t if any, or else adds .B x to .B t and return .B x \&. .sp .I val add : .B t -> data -> unit .sp .B add t x adds .B x to .B t \&. If there is already an instance of .B x in .B t , it is unspecified which one will be returned by subsequent calls to .B find and .B merge \&. .sp .I val remove : .B t -> data -> unit .sp .B remove t x removes from .B t one instance of .B x \&. Does nothing if there is no instance of .B x in .B t \&. .sp .I val find : .B t -> data -> data .sp .B find t x returns an instance of .B x found in .B t \&. Raise .B Not_found if there is no such element\&. .sp .I val find_opt : .B t -> data -> data option .sp .B find_opt t x returns an instance of .B x found in .B t or .B None if there is no such element\&. .sp .B "Since" 4.05 .sp .I val find_all : .B t -> data -> data list .sp .B find_all t x returns a list of all the instances of .B x found in .B t \&. .sp .I val mem : .B t -> data -> bool .sp .B mem t x returns .B true if there is at least one instance of .B x in .B t , false otherwise\&. .sp .I val iter : .B (data -> unit) -> t -> unit .sp .B iter f t calls .B f on each element of .B t , in some unspecified order\&. It is not specified what happens if .B f tries to change .B t itself\&. .sp .I val fold : .B (data -> 'a -> 'a) -> t -> 'a -> 'a .sp .B fold f t init computes .B (f d1 (\&.\&.\&. (f dN init))) where .B d1 \&.\&.\&. dN are the elements of .B t in some unspecified order\&. It is not specified what happens if .B f tries to change .B t itself\&. .sp .I val count : .B t -> int .sp Count the number of elements in the table\&. .B count t gives the same result as .B fold (fun _ n \-> n+1) t 0 but does not delay the deallocation of the dead elements\&. .sp .I val stats : .B t -> int * int * int * int * int * int .sp 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\&. .sp