On Sep 10, 2007, at 1:47 , Stuart Cook wrote:
On 9/10/07, PR Stanley <[EMAIL PROTECTED]> wrote:
--count occurrences of chars in string
countCS :: [Char] -> [(Char, Int)]
countCS xs = [(x, (countC x xs)) | x <- [' '..'z'], (countC x xs)
> 0]
A few things to note:
My naive take on it:
import Data.List
import Control.Monad.Reader
countCS = map (liftM2 (,) head length) . group . sort
--
brandon s. allbery [solaris,freebsd,perl,pugs,haskell] [EMAIL PROTECTED]
system administrator [openafs,heimdal,too many hats] [EMAIL PROTECTED]
electrical and computer engineering, carnegie mellon university KF8NH
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe