.TH "Weak.S" 3o 2023-02-12 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 .ft B Weak\&.Make .ft R \&. .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 .ft B data .ft R \&. Note that weak hash sets cannot be marshaled using .ft B output_value .ft R or the functions of the .ft B Marshal .ft R module\&. .sp .I val create : .B int -> t .sp .ft B create n .ft R creates a new empty weak hash set, of initial size .ft B n .ft R \&. 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 .ft B merge t x .ft R returns an instance of .ft B x .ft R found in .ft B t .ft R if any, or else adds .ft B x .ft R to .ft B t .ft R and return .ft B x .ft R \&. .sp .I val add : .B t -> data -> unit .sp .ft B add t x .ft R adds .ft B x .ft R to .ft B t .ft R \&. If there is already an instance of .ft B x .ft R in .ft B t .ft R , it is unspecified which one will be returned by subsequent calls to .ft B find .ft R and .ft B merge .ft R \&. .sp .I val remove : .B t -> data -> unit .sp .ft B remove t x .ft R removes from .ft B t .ft R one instance of .ft B x .ft R \&. Does nothing if there is no instance of .ft B x .ft R in .ft B t .ft R \&. .sp .I val find : .B t -> data -> data .sp .ft B find t x .ft R returns an instance of .ft B x .ft R found in .ft B t .ft R \&. .sp .B "Raises Not_found" if there is no such element\&. .sp .I val find_opt : .B t -> data -> data option .sp .ft B find_opt t x .ft R returns an instance of .ft B x .ft R found in .ft B t .ft R or .ft B None .ft R if there is no such element\&. .sp .B "Since" 4.05 .sp .I val find_all : .B t -> data -> data list .sp .ft B find_all t x .ft R returns a list of all the instances of .ft B x .ft R found in .ft B t .ft R \&. .sp .I val mem : .B t -> data -> bool .sp .ft B mem t x .ft R returns .ft B true .ft R if there is at least one instance of .ft B x .ft R in .ft B t .ft R , false otherwise\&. .sp .I val iter : .B (data -> unit) -> t -> unit .sp .ft B iter f t .ft R calls .ft B f .ft R on each element of .ft B t .ft R , in some unspecified order\&. It is not specified what happens if .ft B f .ft R tries to change .ft B t .ft R itself\&. .sp .I val fold : .B (data -> 'a -> 'a) -> t -> 'a -> 'a .sp .ft B fold f t init .ft R computes .ft B (f d1 (\&.\&.\&. (f dN init))) .ft R where .ft B d1 \&.\&.\&. dN .ft R are the elements of .ft B t .ft R in some unspecified order\&. It is not specified what happens if .ft B f .ft R tries to change .ft B t .ft R itself\&. .sp .I val count : .B t -> int .sp Count the number of elements in the table\&. .ft B count t .ft R gives the same result as .ft B fold (fun _ n \-> n+1) t 0 .ft R 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