
19 Nov
2009
19 Nov
'09
12:07 p.m.
Ian Lynagh wrote:
breaks (',' ==) "123,456,,78" == ["123", "456", "", "78"]
Yes, that is very useful, and we get the other semantics from "runs". So as of now, I am leaning towards: runs = groupBy . on (==) spans p = filter (p . head) . runs p breaks p = filter (not . p . head) . runs p
but personally I don't think this should be standardised.
All of these functions are very simple combinations of existing ones. On the other hand, it took us until now to realize that, so I'm not sure. In any case, I definitely would like to see groupsOf (or a rose by any other name) in the library. Thanks, Yitz