[Issue 13595] A possible problem with std.algorithm.groupBy

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Fri Oct 24 08:21:13 PDT 2014


https://issues.dlang.org/show_bug.cgi?id=13595

hsteoh at quickfur.ath.cx changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |enhancement

--- Comment #2 from hsteoh at quickfur.ath.cx ---
Actually, I take that back. This is not a bug (w.r.t. the current
documentation) because the predicate is expected to be an equivalence relation,
but (x,y)=>((x*y)%3)==0 is not a reflexive relation.

So the issue is more, should groupBy be extended to support non-equivalence
relations? I have considered this before but decided against it because it
would be more inefficient to implement. However, allowing non-equivalence
relations between adjacent elements *does* allow for much more interesting
groupings (e.g., you could implement word breaks with it), so arguably it
should be supported somehow.

Marking this as as enhancement request.

--


More information about the Digitalmars-d-bugs mailing list