[Haskell-cafe] groupBy huh?
Marc Weber
marco-oweber at gmx.de
Fri Mar 4 01:39:42 CET 2011
Excerpts from Jacek Generowicz's message of Fri Mar 04 00:18:07 +0000 2011:
> Prelude Data.List> groupBy (<) [1,2,3,2]
> [[1,2,3,2]]
This is wired. However if you think about the algorithm always using the
first element of a list and comparing it against the next elements you
get
1 < 2 ok, same group
1 < 3 dito
1 < 2 dito
Thus you get [[1,2,3,2]]
Marc Weber
More information about the Haskell-Cafe
mailing list