mirror of
https://github.com/c-cube/ocaml-containers.git
synced 2025-12-06 11:15:31 -05:00
Merge pull request #87 from jpdeplaix/master
Add `CCMultiSet.remove_all` (thanks @jpdeplaix)
This commit is contained in:
commit
85d0ff8f3f
2 changed files with 10 additions and 0 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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]
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue