I haven't found so far a way to do the opposite operation of List.range:
Existent range function in Scala collections:
List.range(1, 4) = [1, 2, 3]
Looking for writing kind of toRanges function that could give me the following results:
List(1,3,4,5,7,8,9).toRanges() = [(1,1), (3,5), (7,9)]
I'm trying to see how's the functional way of achieving it
If you look into How to transform a list of numbers into a list of ranges of consecutive numbers The answer given is too large and imperative.
Thanks