Add CCMultiSet.remove_all

This commit is contained in:
Jacques-Pascal Deplaix 2016-12-06 18:29:50 +01:00
parent d1e33cd135
commit 5279304b40
2 changed files with 10 additions and 0 deletions

View file

@ -33,6 +33,10 @@ module type S = sig
@raise Invalid_argument if [n < 0]
@since 0.6 *)
val remove_all : t -> elt -> t
(** [remove_all set x] removes all occurrences of [x] from [set]
@since NEXT_RELEASE *)
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]
@ -136,6 +140,8 @@ module Make(O : Set.OrderedType) = struct
let remove ms x = remove_mult ms x 1
let remove_all ms x = M.remove x ms
let update ms x f =
let n = count ms x in
match f n with

View file

@ -33,6 +33,10 @@ module type S = sig
@raise Invalid_argument if [n < 0]
@since 0.6 *)
val remove_all : t -> elt -> t
(** [remove_all set x] removes all occurrences of [x] from [set]
@since NEXT_RELEASE *)
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]