[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

[Haskell-cafe] Re: How the following works

2009-04-16 Thread Juan Pedro Bolivar Puente
I find it easier to understand when looking at the declarative meaning of the definition. There is the trivial case of the empty list, but for the non-empty list: The possible inits of the list is the empty list and the inits of the rest of the list with the head element it their front. The

[Haskell-cafe] Re: How the following works

2009-04-16 Thread Juan Pedro Bolivar Puente
:) [[2], [3], [4]] Prelude map (1:) [[2], [3], [4]] [[1,2],[1,3],[1,4]] Because: map f [[2], [3], [4]] = [f [2], f [3], f [4]] So let f = (x:) then: map f [[2], [3], [4]] = [(1:) [2], (1:) [3], (1:) [4]] = [[1, 2], [1, 3], [1, 4]] JP Juan Pedro Bolivar Puente wrote: I

Re: [Haskell-cafe] Best text editor

2009-04-14 Thread Juan Pedro Bolivar Puente
and Visual Haskell had some unique features (such as hovering tooltips showing types) that are now found in the F# editor, and should now be easier to implement with the recent GHC API (I guess). haskell-mode for Emacs does show the type signature of standard functions in the mini-buffer when