Module Program.VarSet

type elt = Var.t
module BaseMap : Std_extra.PatriciaTree.HeterogeneousMap_S with type _ key = elt and type (_, _) value = unit

Underlying basemap, for cross map/set operations

Function shared with Stdlib.Set.S

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

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

Returns the minimal element. O(log n) complexity

  • raises Not_found

    if it is absent

val max_elt : t -> elt

Returns the minimal element. O(log n) complexity

  • raises Not_found

    if it is absent

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

Extra functions

The following functions are not in Stdlib.Set.S.

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

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 -> (elt * 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 -> elt -> unit) -> Stdlib.Format.formatter -> t -> unit

pp_sep defaults to Format.pp_print_cut

Conversion functions

val to_seq : t -> elt Stdlib.Seq.t
val to_rev_seq : t -> elt Stdlib.Seq.t
val add_seq : elt Stdlib.Seq.t -> t -> t
val of_seq : elt Stdlib.Seq.t -> t
val of_list : elt list -> t
val to_list : t -> elt list