Tempo.IntervalSet.Backend.List (Tempo v1.0.0)

Copy Markdown View Source

The default Tempo.IntervalSet.Backend: a sorted, disjoint plain list of member intervals.

The backend state is the member list itself, so a struct literal %Tempo.IntervalSet{intervals: [...]} is a valid list-backed set and two list-backed sets with the same members compare equal with ==. Construction is O(n log n) (the sort in Tempo.IntervalSet.new/2), the walk is the list, and every query is a linear scan — the right trade for the small-to-medium sets that dominate ordinary use.