IntervalSets.jl and UnitRanges
Both represent some intervals with start
β end
.
Both support operations on sets: in
, union
, intersect
, and so on.
UnitRanges define indexing and iterator interface, which is not true sot IntervalSets, but it can be used for indexing with proper toindex
transformation (see for example SampledSignals.jl indexed in seconds interval).
IntervalSets can have infinite elements. Ranges are always finite and have an optional step
parameter, that defaults to one. But IntervalSets are also finite for some types, like ClosedInterval{Float64}(1,3)
) β then itβs similar to 1:3
range.
So, looks like IntervalSets is an abstraction over UnitRanges for intervals of infinite number of elements?