mirror of
https://github.com/c-cube/ocaml-containers.git
synced 2025-12-06 03:05:28 -05:00
multiSet: Add contains function
This commit is contained in:
parent
ab087334e1
commit
97caff7ec1
2 changed files with 9 additions and 0 deletions
|
|
@ -51,6 +51,8 @@ module type S = sig
|
|||
|
||||
val diff : t -> t -> t
|
||||
|
||||
val contains : t -> t -> bool
|
||||
|
||||
val compare : t -> t -> int
|
||||
|
||||
val equal : t -> t -> bool
|
||||
|
|
@ -131,6 +133,11 @@ module Make(O : Set.OrderedType) = struct
|
|||
else None)
|
||||
m1 m2
|
||||
|
||||
let contains m1 m2 =
|
||||
try
|
||||
M.for_all (fun x c -> M.find x m1 >= c) m2
|
||||
with Not_found -> false
|
||||
|
||||
let compare m1 m2 =
|
||||
M.compare (fun x y -> x - y) m1 m2
|
||||
|
||||
|
|
|
|||
|
|
@ -51,6 +51,8 @@ module type S = sig
|
|||
|
||||
val diff : t -> t -> t
|
||||
|
||||
val contains : t -> t -> bool
|
||||
|
||||
val compare : t -> t -> int
|
||||
|
||||
val equal : t -> t -> bool
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue