package core_kernel

  1. Overview
  2. Docs
Industrial strength alternative to OCaml's standard library

Install

Dune Dependency

Authors

Maintainers

Sources

v0.13.1.tar.gz
sha256=2e9dec37cf1b1a05fa3ad24ae8efd1e389b82928d598db097771405da1d6b214
md5=ee4f3b03ce7fa4cb0c27e9b02cc7712d

doc/core_kernel.int_set/Int_set/index.html

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 contiguous ranges in the set. For data that is mostly serial, n should remain very small.

Note that when n gets very large, in addition to poor performance, these operations may throw exceptions since some of the code is not tail-recursive.

type t
val empty : t
val to_string : t -> string
val add_range : t -> int -> int -> t

add_range t i j adds 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; either way the effect is the same.

val add : t -> int -> t

add t i adds i to the set.

val mem : t -> int -> bool

mem t i tests whether i is a member of the set.

val ranges : t -> (int * int) list

ranges t returns a list of all ranges that make up the set.

val max : t -> int option
val min : t -> int option
OCaml

Innovation. Community. Security.