package bogue

  1. Overview
  2. Docs

Unions of ranges of integers

Example

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}"
Dependency graph
type 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
OCaml

Innovation. Community. Security.