[Haskell-cafe] Comments and/or Criticisms

Stuart Cook scook0 at gmail.com
Sun Sep 9 22:18:01 EDT 2007


On 9/10/07, PR Stanley <prstanley at ntlworld.com> wrote:
> Can anyone come up with a better alternative?

*puts on his pointfree hat*

  import Control.Arrow ((&&&))
  import Data.List (group, sort)

  countCS :: [Char] -> [(Char, Int)] -- Char can be generalised to any Ord
  countCS = map (head &&& length) . group . sort


Stuart


More information about the Haskell-Cafe mailing list