package biocaml
Install
Dune Dependency
Authors
Maintainers
Sources
sha256=fae219e66db06f81f3fd7d9e44717ccf2d6d85701adb12004ab4ae6d3359dd2d
sha512=f6abd60dac2e02777be81ce3b5acdc0db23b3fa06731f5b2d0b32e6ecc9305fe64f407bbd95a3a9488b14d0a7ac7c41c73a7e18c329a8f18febfc8fd50eccbc6
doc/biocaml.unix/Biocaml_unix/Iset/index.html
Module Biocaml_unix.Iset
Source
DIET : Discrete Interval Encoding Trees
Sets of integers represented as ranges
This data structure is efficient for large sets of integers where many adjacent integers are all part of the set. This will have higher overhead for sets with lots of point elements, but will be much more efficient for sets containing mostly ranges.
add_range t lo hi
adds the range of integers lo, hi
(including both endpoints) to the given set, returning a new set
remove_range lo hi t
removes a range of elements from the given set, returning a new set
Compute the union of two sets. This is the set whose elements are those elements in either input set.
Compute the intersection of two sets. This is the set whose elements are those in *both* of the input sets.
Compute the difference between two sets. This is the set of elements that are in the first but not in the second. Unlike union
and inter
, order matters here.
Create the complement of the given set - i.e. the set of all values not in the input set.
Compare two sets. It is not safe to use the polymorphic (<) and related functions to compare these sets, as the tree representation used can balance in multiple ways.
Test whether two sets are equal. It is not safe to use the polymorphic (=) on these sets, as the same set can have multiple representations depending on how it was built.
iter_range ~f t
calls f
once for each contiguous range of t
. The contiguous ranges of a set are sequences of adjacent integers all part of the set.
fold f t x0
returns the final result of merging each element of t
into x0
using merge function f
As fold, but operates on contiguous ranges
Tests whether a predicate applies to all elements of the set
Test whether some element of a set satisfies a predicate
Builds the subset of those elements that satisfy the predicate
partitions the input set into two sets with elements that satisfy the predicate and those that don't