RangeSet
Instead of working with a set of integers [1, 2, 3, 7, 8, 9, 11], use a set of contiguous ranges [1..3, 7..9, 11..11]
Most of the opperations available on MapSet have an equivalent in RangeSet.
For example
assert RangeSet.intersection([1..6], [4..10]) == [4..6]Installation
If available in Hex, the package can be installed
by adding rangeset to your list of dependencies in mix.exs:
def deps do
[
{:rangeset, "~> 0.1.0"}
]
endDocumentation can be generated with ExDoc and published on HexDocs. Once published, the docs can be found at https://hexdocs.pm/rangeset.