Confusing with chunkBy

Maksim maximcorp at mail.ru
Mon Feb 15 19:57:39 UTC 2021


Hello.
Why
chunkBy!((a,b) => a[1] == b[1])(
[
   [1,1],
   [1,2],
   [2,2],
   [2,1]
]);
returns a range with 3 subranges:
[
   [[1,1]],
   [[1,2], [2,2]],
   [[2,1]]
]
I thought it would returns a range with 2 subranges
[
   [[1,1], [2,1]],
   [[1,2],[2,2]]
]
It turns out that [1,1] and [2,1] are not grouped.

Thanks.


More information about the Digitalmars-d-learn mailing list