Confusing with chunkBy

Adam D. Ruppe destructionator at gmail.com
Mon Feb 15 21:03:47 UTC 2021


On Monday, 15 February 2021 at 20:51:53 UTC, Maksim wrote:
> Thanks for answer, Adam. I lost the key word "adjacent".

yeah, you aren't the only one, I think the docs should call it 
more more illustratively with an example or something too.

The reason why it is designed this way is just to get minimum 
cost - this is the simplest thing that can be useful so you don't 
pay for a sort you don't need. But then if you do need it, gotta 
do it yourself. (And sort requires an array to put the results 
into, so if you pass it an array it will just mutate the existing 
one, and if it isn't passed an array, again it does the bare 
minimum work it can to be useful, so it may fail compile and you 
must allocate one yourself. Just a couple other things to keep 
your eyes open for as you explore the library.)


More information about the Digitalmars-d-learn mailing list