More on "Component Programming"
Andrei Alexandrescu
SeeWebsiteForEmail at erdani.org
Mon May 27 18:42:13 PDT 2013
On 5/27/13 8:16 PM, bearophile wrote:
> The "group" of Phobos is useful and it has purposes quite different from
> the Perl6 "classify", both are needed.
> I have also suggested "group" to act more like the Python
> "itertools.grouby" and yield not just the (head,count) tuples, but
> (head,lazy_range_of_the_equality_ class) that is quite useful, example:
>
>
>>>> from itertools import groupby
>>>> s = "abABACAaaaaBCAB"
>>>> [(h, list(g)) for h,g in groupby(s, key=str.isupper)]
> [(False, ['a', 'b']), (True, ['A', 'B', 'A', 'C', 'A']), (False, ['a',
> 'a', 'a', 'a']), (True, ['B', 'C', 'A', 'B'])]
>
> I think Andrei was looking at this change with interest. Changing Phobos
> group() API now is maybe not easy to do, so maybe it's better to
> introduce a differently named function for that, like one named
> "groupAll" or something similar.
I wrote that a while ago. Someone please review and pull
https://github.com/D-Programming-Language/phobos/pull/1186 already!
Andrei
More information about the Digitalmars-d
mailing list