Re: [Haskell-cafe] groupBy huh?

2011-03-07 Thread Henning Thielemann
Jacek Generowicz schrieb: Hi Cafe, It seems that I don't understand what groupBy does. I expect it to group together elements as long as adjacent ones satisfy the predicate, so I would expect ALL four of the following to give one group of 3 and a group of 1. Prelude :m + Data.List

[Haskell-cafe] groupBy huh?

2011-03-03 Thread Jacek Generowicz
Hi Cafe, It seems that I don't understand what groupBy does. I expect it to group together elements as long as adjacent ones satisfy the predicate, so I would expect ALL four of the following to give one group of 3 and a group of 1. Prelude :m + Data.List Prelude Data.List groupBy () abcb

Re: [Haskell-cafe] groupBy huh?

2011-03-03 Thread Marc Weber
Excerpts from Jacek Generowicz's message of Fri Mar 04 00:18:07 + 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

Re: [Haskell-cafe] groupBy huh?

2011-03-03 Thread Daniel Fischer
On Friday 04 March 2011 01:18:07, Jacek Generowicz wrote: Hi Cafe, It seems that I don't understand what groupBy does. I expect it to group together elements as long as adjacent ones satisfy the predicate, so I would expect ALL four of the following to give one group of 3 and a group of

Re: [Haskell-cafe] groupBy huh?

2011-03-03 Thread Jacek Generowicz
On 2011 Mar 4, at 01:39, Marc Weber wrote: Excerpts from Jacek Generowicz's message of Fri Mar 04 00:18:07 + 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

Re: [Haskell-cafe] groupBy huh?

2011-03-03 Thread Brandon S Allbery KF8NH
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 3/3/11 20:09 , Jacek Generowicz wrote: 1 2 ok, same group 1 3 dito 1 2 dito Thus you get [[1,2,3,2]] OK, that works, but it seems like a strange choice ... Stability is often valued in functions like this: the order of elements is not

Re: [Haskell-cafe] groupBy huh?

2011-03-03 Thread Joachim Breitner
Hi, Am Freitag, den 04.03.2011, 01:18 +0100 schrieb Jacek Generowicz: It seems that I don't understand what groupBy does. I expect it to group together elements as long as adjacent ones satisfy the predicate, so I would expect ALL four of the following to give one group of 3 and a group

Re: [Haskell-cafe] groupBy huh?

2011-03-03 Thread wren ng thornton
On 3/3/11 7:18 PM, Jacek Generowicz wrote: Hi Cafe, It seems that I don't understand what groupBy does. I expect it to group together elements as long as adjacent ones satisfy the predicate, so I would expect ALL four of the following to give one group of 3 and a group of 1. Prelude :m +

Re: [Haskell-cafe] groupBy huh?

2011-03-03 Thread wren ng thornton
On 3/3/11 8:14 PM, Brandon S Allbery KF8NH wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 3/3/11 20:09 , Jacek Generowicz wrote: 1 2 ok, same group 1 3 dito 1 2 dito Thus you get [[1,2,3,2]] OK, that works, but it seems like a strange choice ... Stability is often valued in

Re: [Haskell-cafe] groupBy huh?

2011-03-03 Thread Jacek Generowicz
On 2011 Mar 4, at 02:14, Brandon S Allbery KF8NH wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 3/3/11 20:09 , Jacek Generowicz wrote: 1 2 ok, same group 1 3 dito 1 2 dito Thus you get [[1,2,3,2]] OK, that works, but it seems like a strange choice ... Stability is often