module Hashset: sig
.. end
Hashset
is similar to Hashtbl
, but it stores only keys, and
the value is unit
for all keys.
See also http://caml.inria.fr/pub/docs/manual-ocaml/libref/Hashtbl.html for
the description of the methods for hash tables.
type 'a
t = ('a, unit) Ext.Hashtbl.t
val create : ?random:bool -> int -> ('a, 'b) Ext.Hashtbl.t
create n
creates a new, empty hash set with initial size n
.
val add : ('a, unit) Ext.Hashtbl.t -> 'a -> unit
add hs x
adds x
to hash set hs
.
val mem : ('a, 'b) Ext.Hashtbl.t -> 'a -> bool
mem hs x
checks if x
exists in hs
.
val iter : ('a -> unit) -> ('a, unit) Ext.Hashtbl.t -> unit
iter f hs
applies f to all items in the hash set hs
.
val fold : ('a -> 'b -> 'b) -> ('a, unit) Ext.Hashtbl.t -> 'b -> 'b
fold f hs init
computes (f iN ... (f i1 init)...)
, where
i1 ... iN
are the items in hs
.
val to_list : ('a, unit) Ext.Hashtbl.t -> 'a list
Converts the given hash set into a list.
val sum_map : ('a -> int) -> ('a, unit) Ext.Hashtbl.t -> int
sum_map f hs
applies f to all items in hs
, returns the sum
of all the results. f
returns an int.
val sumf_map : ('a -> float) -> ('a, unit) Ext.Hashtbl.t -> float
sum_map f hs
applies f to all items in hs
, returns the sum
of all the results. f
returns a float.
val filter : ('a -> bool) -> ('a, unit) Ext.Hashtbl.t -> unit
filter f hs
applies the boolean function f
on every item
in hs
and remove the item if f
returns false
.
type 'a
t' = ('a, unit) Ext.Hashtbl.t