[Haskell-cafe] list of range

Henning Thielemann lemming at henning-thielemann.de
Mon Oct 4 16:27:12 UTC 2021


On Mon, 4 Oct 2021, PICCA Frederic-Emmanuel wrote:

>> Is it necessary to preserve the structure of separate ranges or would it
>> be ok to just store [Int] or Set Int?
>
> I think that it is efficient to keep the structure, but since haskell is lazy, I am wondering, if the best solution
> would not be to create the Set of Int. (An Ordered Set).

Set Int is not lazy. [Int] is lazy, but it is inefficient for eliminating 
duplicates. IntSet is also strict, but internally it is almost a bit 
vector, i.e. storage efficient. If the ranges are really large, then you 
might need data-interval&friends. However, a list of numbers of image 
files might not be that large, and IntSet will probably be a good choice.


More information about the Haskell-Cafe mailing list