
10 Sep
2007
10 Sep
'07
1:58 a.m.
Hi Any comments and/or criticisms would be most appreciated: --count the occurrences of char in string countC :: Char -> [Char] -> Int countC x xs = sum [1 | c <- xs, c == x] --count occurrences of chars in string countCS :: [Char] -> [(Char, Int)] countCS xs = [(x, (countC x xs)) | x <- [' '..'z'], (countC x xs) > 0] Can anyone come up with a better alternative? Thanks, Paul