Re: [Haskell-cafe] Re: General function to count list elements?

2009-04-20 Thread Peter Verswyvelen
A solution with enums would severely suffer from the expression problem... One would need to extent the enums every time one needs to support a new function. Maybe could be solved with type classes, don't know. On Mon, Apr 20, 2009 at 3:57 PM, Achim Schneider bars...@web.de wrote: Lennart

[Haskell-cafe] Re: General function to count list elements?

2009-04-20 Thread Achim Schneider
Lennart Augustsson lenn...@augustsson.net wrote: On Sun, Apr 19, 2009 at 10:43 PM, Peter Verswyvelen bugf...@gmail.com wrote: For example, suppose you have a predicate a - Bool, and a list of these predicates [a - Bool], but you want to remove all functions that are obviously equal in the

Re: [Haskell-cafe] Re: General function to count list elements?

2009-04-20 Thread Luke Palmer
On Mon, Apr 20, 2009 at 7:57 AM, Achim Schneider bars...@web.de wrote: Lennart Augustsson lenn...@augustsson.net wrote: On Sun, Apr 19, 2009 at 10:43 PM, Peter Verswyvelen bugf...@gmail.com wrote: For example, suppose you have a predicate a - Bool, and a list of these predicates [a -

[Haskell-cafe] Re: General function to count list elements?

2009-04-19 Thread Achim Schneider
Peter Verswyvelen bugf...@gmail.com wrote: Sometimes I do miss the pragmatic C solution:- two function pointers that are equal surely represent the same functions (although in C nothing is really sure ;) In haskell, they would, but C doesn't give you the same guarantee: int evil = 0; int

[Haskell-cafe] Re: General function to count list elements?

2009-04-18 Thread Juan Pedro Bolivar Puente
The problem is that you must note in the type signature the fact that 'a' must be a member of typeclass Eq in order to be able to use == count :: (Eq a) = a - [a] - Int count x ys = length (filter (== x) ys) JP michael rice wrote: Is there a general function to count list elements. I'm trying