module Int_set:An implementation of compressed integer sets using lists of integer ranges. Operations such as adding and membership are O(n) where n is the number of contigous ranges in the set. For data that is mostly serial, n should remain very small.sig..end
Note that when n gets very large, in addition to poor performance, this behavior may
throw exceptions since some of the code is not tail-recursive.
type t
val create : unit -> tval to_string : t -> stringval add_range : t -> int -> int -> tadd_range t i j add all the numbers between i and j (inclusive) to the set. Note
that it doesn't matter which order i and j are specified in, the effect is the
same.val add : t -> int -> tadd t i add i to the setval mem : t -> int -> boolmem t i test whether i is a member of the setval ranges : t -> (int * int) listranges t return a list of all ranges that make up the setval max : t -> int optionmax t the biggest number in the set (if it exists)val min : t -> int optionmin t the smallest number in the set (if it exists)