Macaw.Data.Source.Ranges (macaw_data v0.21.1)
View SourceLists of slot ranges, the algebra a source manager plans and holds by (spec/01 §6.4.2).
A range is {lo, hi}, the slots from lo up to but not including hi, either nil
for unbounded (Macaw.Data.Source.Demand.range/0). A list is normal when it is
sorted, disjoint, merged where its ranges meet and holds no empty range: every function
here answers one, and normalize/1 makes one of any list.
iex> alias Macaw.Data.Source.Ranges
iex> Ranges.normalize([{5, 9}, {nil, 2}, {2, 3}, {8, 12}, {4, 4}])
[{nil, 3}, {5, 12}]
iex> Ranges.subtract([{0, nil}], [{3, 5}, {9, 10}])
[{0, 3}, {5, 9}, {10, nil}]
iex> Ranges.covers?([{0, 10}], {2, 4})
true
Summary
Functions
Whether every slot of range is in ranges.
The slots in both a and b.
ranges sorted, disjoint, merged where they meet, empty ones dropped.
The slots of a that are not in b.
Every slot in a or b.
Types
@type range() :: Macaw.Data.Source.Demand.range()
Functions
Whether every slot of range is in ranges.
The slots in both a and b.
ranges sorted, disjoint, merged where they meet, empty ones dropped.
The slots of a that are not in b.
Every slot in a or b.