package range
Install
Dune Dependency
Authors
Maintainers
Sources
sha256=76986a77f2e9b3046be13a5b62a781e0483405c9376671a31866da56a0ddec89
md5=7b9732f6ba03ddc22cf0b4b7bd04dbe1
doc/range/Range/index.html
Module Range
Source
Range module provide a type for handling the description of an integer sequence described by a start value and a stop value. This module provide functions to fold, filter and map this range.
The main goal is to : * provide a split capacity in order to make life easy for distributed processing. * avoid the use of list or lazy list when the only need is to sequence a range of integer.
t type correspond to an integer range value
'a number type is an integer with constraints *
include Base.Equal.S with type t := t
from start_value stop_value : will create a t value representing the range described by the two values given in parameter.
filter f range : will create a new Range.t value using predicate function f. This modifies the behaviour of iter or fold function in order to apply only to values that satisfies the predicate.
is filtered predicate
test if a Range.t value contain a filter or map function transforming data.
length range_value : return the number of elements contained in rang_value
fold the equivalent of List.fold_left applied to integer range_record explore all the values contained in the range value applying f to the accumulator and the current element read by fold. If a filter was associated to the range value, only element validated by the predicate f will be passed to the function.
fold_right explore all the values contained in the range value, in reverse order, starting by the last value to the first one, applying f to the accumulator and the current element read by fold. If a filter was associated to the range value, only element validated by the predicate f will be passed to the function.
iter apply a function with side effect on all values of the range. This function support filtering.
val split :
[ `Greater_than_zero ] Number.t ->
[ `Greater_than_zero ] Number.t ->
t ->
t Base.list
split a range value into a list of smaller range, useful for batching in parallel processing.
contain function to test if an integer value is contained in a Range.t values
new Range.t value representing the common value between two Range.t values.
Join to generate a new Range.t value contained both a and b