module Selection:sig
..end
Unions of ranges of integers
We define two sets, s=[0..5; 10..20]
and r=[4..15]
,
and we compute their union and intersection.
open Bogue.Selection;;
# let s = of_list [(0,5); (10,20)];;
val s : t = <abstr>
# sprint s;;
- : string = "{0..5, 10..20}"
# let r = of_list [(4,15)];;
val r : t = <abstr>
# sprint (union s r);;
- : string = "{0..20}"
# sprint (intersect s r);;
- : string = "{4..5, 10..15}"
type
t
val empty : t
val to_list : t -> (int * int) list
val of_list : (int * int) list -> t
val mem : t -> int -> bool
val toggle : t -> int -> t
val remove : t -> int -> t
val add : t -> int -> t
val union : t -> t -> t
val intersect : t -> t -> t
val sprint : t -> string
val iter : (int -> unit) -> t -> unit