Confusing with chunkBy

Adam D. Ruppe destructionator at gmail.com
Mon Feb 15 20:08:45 UTC 2021


On Monday, 15 February 2021 at 19:57:39 UTC, Maksim wrote:
> Hello.
> Why

The docs say it: "chunks an input range into subranges of 
equivalent adjacent elements."

The key word there is "adjacent".

and the docs follow up "Elements in the subranges will always 
appear in the same order they appear in the original range."


What this means is it only looks at two side-by-side elements at 
a time, it doesn't scan ahead to find separated chunks.

You may want to sort your data before you chunk it to ensure 
matching things are next to each other.


More information about the Digitalmars-d-learn mailing list