[Haskell-cafe] How to split this string.

Steve Horne sh006d3592 at blueyonder.co.uk
Thu Jan 5 12:26:37 CET 2012

On 05/01/2012 11:09, Brandon Allbery wrote:
> On Thu, Jan 5, 2012 at 05:57, Steve Horne <sh006d3592 at blueyonder.co.uk 
> <mailto:sh006d3592 at blueyonder.co.uk>> wrote:
>      --  groupCut - Similar to groupBy, but where groupBy assumes an
>     equivalence relation,
>      --  groupCut takes a function that indicates where to cut. The
>     two parameters to this
>      --  function are always adjacent items from the list, and if the
>     function returns True,
>      --  a cut is done between the two items.
> span/break?
Using those, the test function won't always be passed two *adjacent* 
elements from the list. After all, they're based on takeWhile and 
dropWhile, which take unary functions, meaning an element has already 
been curried in (the starting element of the group).

That's probably how the current groupBy is implemented - the approach 
that assumes an equivalence relation, giving unexpected results when the 
By function isn't an equivalence relation.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20120105/180c1762/attachment.htm>

More information about the Haskell-Cafe mailing list