Ranges/algorithms for aggregation

"Luís "Luís
Fri Mar 21 10:20:36 PDT 2014


On Friday, 21 March 2014 at 16:53:46 UTC, H. S. Teoh wrote:
> Be aware, though, that groupBy only compares *adjacent* 
> elements for
> equivalence; it does not sort the input. So if your input has 
> equivalent
> elements interspersed with non-equivalent elements, you will 
> have the
> equivalent elements split into multiple runs in the output.

I think that's why Justin used sort. The hashGroupBy proposed by 
bearophile would avoid the sort and the additional memory usage 
though, so that would be even better.


More information about the Digitalmars-d-learn mailing list