package biocaml
Install
Dune Dependency
Authors
Maintainers
Sources
md5=e292efa2f61fec33dad63ec897106f59
sha512=35519bf3b1e67a9191ef9bb74eba0dae941e0d05bad89076a36f507dc5c2d105a03c1c917d5a3f7ed9d1da4acbf3199582f78c308aa2a5a22c21f743945c852b
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