Module type PatriciaTree.Set_S

Signature for sets implemented using Patricia trees.

module BaseMap : BaseMap_S with type (_, _) value = unit

Underlying basemap, for cross map/set operations

type t = unit BaseMap.t

This part of the interface should be a subset of Set.S

type key = unit BaseMap.key
val empty : t
val is_empty : t -> bool
val mem : key -> t -> bool
val add : key -> t -> t
val singleton : key -> t
val cardinal : t -> int
val is_singleton : t -> key option
val remove : key -> t -> t
val union : t -> t -> t
val inter : t -> t -> t
val disjoint : t -> t -> bool
val split : key -> t -> t * bool * t
val iter : (key -> unit) -> t -> unit
val fold : (key -> 'b -> 'b) -> t -> 'b -> 'b
val filter : (key -> bool) -> t -> t
val for_all : (key -> bool) -> t -> bool
val min_elt : t -> key

Returns the (key,value) where Key.to_int key is minimal (in unsigned representation of integers); O(log n) complexity.

val max_elt : t -> key

Returns the (key,value) where Key.to_int key is maximal (in unsigned representation of integers); O(log n) complexity.

val pop_minimum : t -> (key * t) option

The following functions are not in Set.S.

pop_minimum m returns None if is_empty m, or Some(key,m') where key = min_elt m and m' = remove m key. O(log(n)) complexity.

val pop_maximum : t -> (key * t) option

pop_maximum m returns None if is_empty m, or Some(key,m') where key = max_elt m and m' = remove m key. O(log(n)) complexity.

val pretty : ?pp_sep:(Stdlib.Format.formatter -> unit -> unit) -> (Stdlib.Format.formatter -> key -> unit) -> Stdlib.Format.formatter -> t -> unit

pp_sep defaults to Format.pp_print_cut

val equal : t -> t -> bool
val subset : t -> t -> bool