[Haskell-cafe] Suspected stupid Haskell Question

Dougal Stanton ithika at gmail.com
Wed Oct 17 06:26:35 EDT 2007


On 17/10/2007, Big_Ham <joymachine2001 at hotmail.com> wrote:
>
> Is there a library function to take a list of Strings and return a list of
> ints showing how many times each String occurs in the list.
>
> So for example:
>
> ["egg", "egg", "cheese"] would return [2,1]
>
> I couldn't find anything on a search, or anything in the librarys.
>
> Thanks BH.

No, but it is also trivial to create, with the 'group' function in
Data.List. I'll stop there though, cos this could be a homework
question.

Cheers,

D.


More information about the Haskell-Cafe mailing list