package bogue

  1. Overview
  2. Docs

Module Bogue.SelectionSource

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
Sourcetype t
Sourceval empty : t
Sourceval is_empty : t -> bool
Sourceval size : t -> int

Number of selected integers

Sourceval to_list : t -> (int * int) list
Sourceval of_list : (int * int) list -> t
Sourceval range : (int * int) -> t
Sourceval first : t -> int
Sourceval last : t -> int
Sourceval mem : t -> int -> bool
Sourceval toggle : t -> int -> t
Sourceval remove : t -> int -> t
Sourceval add : t -> int -> t
Sourceval union : t -> t -> t

Not tail-recursive

Sourceval intersect : t -> t -> t

Not tail-recursive

Sourceval invert : first:int -> last:int -> t -> t

invert ~first ~last sel returns a selection containing all integers not selected in sel, withing the range [first, last].

Sourceval sprint : t -> string
Sourceval iter : (int -> unit) -> t -> unit
OCaml

Innovation. Community. Security.