On 05/01/2012 11:09, Brandon Allbery wrote:
On Thu, Jan 5, 2012 at 05:57, Steve Horne <[email protected] <mailto:[email protected]>> 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.

_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to