Module BatSet

module BatSet: sig .. end

Sets over ordered types.

This module implements the set data structure, given a total ordering function over the set elements. All operations over sets are purely applicative (no side-effects). The implementation uses balanced binary trees, and is therefore reasonably efficient: insertion and membership take time logarithmic in the size of the set, for instance.

Note OCaml, Batteries Included, provides two implementations of sets: polymorphic sets and functorized sets. Functorized sets (see BatSet.S and BatSet.Make) are slightly more complex to use but offer stronger type-safety. Polymorphic sets make it easier to shoot yourself in the foot. In case of doubt, you should use functorized sets.

The functorized set implementation is built upon Stdlib's Set module, but provides the complete interface.


Functorized Sets
module type OrderedType = BatInterfaces.OrderedType

Input signature of the functor Set.Make.

module type S = sig .. end

Output signature of the functor Set.Make.

module Make: 
functor (Ord : OrderedType-> S with type elt = Ord.t

Functor building an implementation of the set structure given a totally ordered type.

module Make2: 
functor (O1 : OrderedType-> 
functor (O2 : OrderedType-> sig .. end
Common