[Haskell-cafe] Suspected stupid Haskell Question

Stefan Holdermans stefan at cs.uu.nl
Wed Oct 17 06:22:50 EDT 2007


BH,

> 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]

freq xs = map length (group xs)

HTH,

   Stefan


More information about the Haskell-Cafe mailing list