
10 Sep
2007
10 Sep
'07
6:36 a.m.
On Sep 10, 2007, at 1:47 , Stuart Cook wrote:
On 9/10/07, PR Stanley
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] allbery@kf8nh.com system administrator [openafs,heimdal,too many hats] allbery@ece.cmu.edu electrical and computer engineering, carnegie mellon university KF8NH