]> matita.cs.unibo.it Git - pkg-cerco/frama-c-cost-plugin.git/blob - plugin/eset.ml
Imported Upstream version 0.1
[pkg-cerco/frama-c-cost-plugin.git] / plugin / eset.ml
1
2 module type OrderedType = Set.OrderedType
3
4 module type S = sig
5   include Set.S
6
7   val of_list : elt list -> t
8   val to_list : t -> elt list
9   val disjoint : t -> t -> bool
10   val is_subset : t -> t -> bool
11 end
12
13 module Make (Ord : OrderedType) : S with type elt = Ord.t = struct
14   module M = Set.Make (Ord)
15   include M
16
17   let to_list = elements
18   let of_list l = List.fold_right M.add l M.empty
19   let disjoint s1 s2 = M.inter s1 s2 = M.empty
20
21   let is_subset set1 set2 =
22     let f x res = res && (mem x set2) in
23     fold f set1 true
24 end