Legend:
Library
Module
Module type
Parameter
Class
Class type
Ranges of contiguous integers (integer intervals). A range is a contiguous sequence of integers from a lower bound to an upper bound. For example, [2, 10] is the set of integers from 2 through 10, inclusive of 2 and 10.
overlap u v returns amount of overlap between two ranges. A positive value indicates number of integers common to u and v. A negative value indicates the number of integers in between non-overlapping ranges. A zero value means the ranges are exactly adjacent to each other. The relation is symmetric.
gap u v returns the size of the gap between u and v. It is equivalent to the negative of overlap.
Set Operations
val union : t->t->[ `Joint of t| `Disjoint of t * t ]
union u v returns the range(s) representing the union of u and v. If u and v overlap, their union can be represented as a single range. If not, their union is a disjoint combination of two ranges.
Return maximum gap between adjacent pairs of given ranges. Raise Failure if any pairs of given ranges not positionally comparable, or if given less than two ranges.
More Specialized Operations
val find_min_range :
?init_direction:string ->t->(t-> bool)->int ->t option
find_min_range v pred i finds the minimum sized range within v centered around i that satisfies pred. Successively larger ranges are created starting from [i, i] and the first one to satisfy pred is returned. None is returned if the given range v itself is reached and pred still fails. Raise Failure if i not within v.
The first range tried is [i, i], by default the second is [i, i+1], the third [i-1, i+1], the fourth [i-1, i+2], and so on. The optional init_direction must be either "fwd" or "rev". If "fwd", which is the default, the range size is initially increased in the forward direction. If "rev", the second range tried will be [i-1, i]. If the range boundary is reached on either side, the size continues to be increased by incrementing on the opposing side.
val expand_assoc_list : (t * 'a) list->(int * 'a list) list
exp_assoc_list dat returns a list associating each integer i with the list of values associated with all ranges overlapping i in dat. The set of integers considered is the union of all in given dat.
val find_regions : ?max_gap:int ->('a-> bool)->(t * 'a) list->t list