module type S = sig
.. end
type
elt
type
t
val empty : t
val is_empty : t -> bool
val mem : t -> elt -> bool
val count : t -> elt -> int
val singleton : elt -> t
val add : t -> elt -> t
val remove : t -> elt -> t
val add_mult : t -> elt -> int -> t
add_mult set x n
adds n
occurrences of x
to set
Since 0.6
Raises Invalid_argument
if n < 0
val remove_mult : t -> elt -> int -> t
remove_mult set x n
removes at most n
occurrences of x
from set
Since 0.6
Raises Invalid_argument
if n < 0
val update : t -> elt -> (int -> int) -> t
update set x f
calls f n
where n
is the current multiplicity
of x
in set
(0
to indicate its absence); the result of f n
is the new multiplicity of x
.
Since 0.6
Raises Invalid_argument
if f n < 0
val min : t -> elt
Minimal element w.r.t the total ordering on elements
val max : t -> elt
Maximal element w.r.t the total ordering on elements
val union : t -> t -> t
union a b
contains as many occurrences of an element x
as count a x + count b x
.
val meet : t -> t -> t
meet a b
is a multiset such that
count (meet a b) x = max (count a x) (count b x)
val intersection : t -> t -> t
intersection a b
is a multiset such that
count (intersection a b) x = min (count a x) (count b x)
val diff : t -> t -> t
MultiSet difference.
count (diff a b) x = max (count a x - count b x) 0
val contains : t -> t -> bool
contains a x = (count m x > 0)
val compare : t -> t -> int
val equal : t -> t -> bool
val cardinal : t -> int
Number of distinct elements
val iter : t -> (int -> elt -> unit) -> unit
val fold : t -> 'b -> ('b -> int -> elt -> 'b) -> 'b
val of_list : elt list -> t
val to_list : t -> elt list
val to_seq : t -> elt CCMultiSet.sequence
val of_seq : elt CCMultiSet.sequence -> t
val of_list_mult : (elt * int) list -> t
Since 0.19
val to_list_mult : t -> (elt * int) list
Since 0.19
val to_seq_mult : t -> (elt * int) CCMultiSet.sequence
Since 0.19
val of_seq_mult : (elt * int) CCMultiSet.sequence -> t
Since 0.19