mirror of
https://github.com/c-cube/ocaml-containers.git
synced 2025-12-07 11:45:31 -05:00
Add CCMultiSet.remove_all
This commit is contained in:
parent
d1e33cd135
commit
5279304b40
2 changed files with 10 additions and 0 deletions
|
|
@ -33,6 +33,10 @@ module type S = sig
|
||||||
@raise Invalid_argument if [n < 0]
|
@raise Invalid_argument if [n < 0]
|
||||||
@since 0.6 *)
|
@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
|
val update : t -> elt -> (int -> int) -> t
|
||||||
(** [update set x f] calls [f n] where [n] is the current multiplicity
|
(** [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]
|
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 ms x = remove_mult ms x 1
|
||||||
|
|
||||||
|
let remove_all ms x = M.remove x ms
|
||||||
|
|
||||||
let update ms x f =
|
let update ms x f =
|
||||||
let n = count ms x in
|
let n = count ms x in
|
||||||
match f n with
|
match f n with
|
||||||
|
|
|
||||||
|
|
@ -33,6 +33,10 @@ module type S = sig
|
||||||
@raise Invalid_argument if [n < 0]
|
@raise Invalid_argument if [n < 0]
|
||||||
@since 0.6 *)
|
@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
|
val update : t -> elt -> (int -> int) -> t
|
||||||
(** [update set x f] calls [f n] where [n] is the current multiplicity
|
(** [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]
|
of [x] in [set] ([0] to indicate its absence); the result of [f n]
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue