Remonder: this is because interval is used for text selection and/or cursor position. From that POV, 3 to: 2 is not equal to 4 to: 3. From collection POV, they are both an empty collection. I think that i once proposed to distinguish the two usages and introduce a TextInterval for that purpose.

Le lun. 29 oct. 2018 à 01:35, Chris Cunningham <cunningham.cb@gmail.com> a écrit :


On Sun, Oct 28, 2018 at 2:53 PM Nicolas Cellier <nicolas.cellier.aka.nice@gmail.com> wrote:

and 
 
Intervals:
   (0 to: 1) = (0 to: 5/3). "true"
   (0 to: 1) hash = (0 to: 5/3) hash. "false"

In the inbox is collections-cbc.810.mcz, which fixes both of these bugs.

You can test them out - #hash still replicates the bugs, while #hashBetterFastArrayCompatible (on Interval) and #hashBetterFastIntervalCompatible (on Array) makes both work.  The later also implements your idea of only testing some of the elements - the first and last 16.

It slows down hash speed of Interval roughly an order of magnitude, though.

If anyone hash ideas I'd be interested. Failing that, I'll ruminate on them for the next several days, and eventually push something in that fixes this (meanwhile moving that package to treated).
-----
Here is the series of 'tests' that I did while working on these with various timings.

{
[(1 to: 100 by: 1) hash] bench.
[(1 to: 100 by: 1) hashBetter] bench.
[(1 to: 100 by: 1) hashBetterAlsoFixBug3380] bench.
[(1 to: 100 by: 1) hashSlowerBetterAlsoFixBug3380] bench.
[(1 to: 100 by: 1) hashFastArrayCompatible] bench.
[(1 to: 100 by: 1) hashBetterFastArrayCompatible] bench.
'---'.
[(1 to: 100.3 by: 1) hash] bench.
[(1 to: 100.3 by: 1) hashBetter] bench.
[(1 to: 100.3 by: 1) hashBetterAlsoFixBug3380] bench.
[(1 to: 100.3 by: 1) hashSlowerBetterAlsoFixBug3380] bench.
[(1 to: 100.3 by: 1) hashFastArrayCompatible] bench.
[(1 to: 100.3 by: 1) hashBetterFastArrayCompatible] bench.
}

{
(0 to: 1) = (0 to: 5/3). 
(0 to: 1) hash = (0 to: 5/3) hash.
(0 to: 1) hashBetter = (0 to: 5/3) hashBetter.
(0 to: 1) hashBetterAlsoFixBug3380 = (0 to: 5/3) hashBetterAlsoFixBug3380.
(0 to: 1) hashSlowerBetterAlsoFixBug3380 = (0 to: 5/3) hashSlowerBetterAlsoFixBug3380.
(0 to: 1) hashFastArrayCompatible = (0 to: 5/3) hashFastArrayCompatible.
(0 to: 1) hashBetterFastArrayCompatible = (0 to: 5/3) hashBetterFastArrayCompatible.
}


{
(1 to: 3) = #(1 2 3).
(1 to: 3) hash = #(1 2 3) hash.
(1 to: 3) hashBetter = #(1 2 3) hash.
(1 to: 3) hashBetterAlsoFixBug3380 = #(1 2 3) hash.
(1 to: 3) hashSlowerBetterAlsoFixBug3380 = #(1 2 3) hash.
(1 to: 3) hashFastArrayCompatible = #(1 2 3) hashFastIntervalCompatible.
(1 to: 3) hashBetterFastArrayCompatible = #(1 2 3) hashBetterFastIntervalCompatible.
}

-cbc