
4 Feb
2009
4 Feb
'09
6:43 a.m.
On Wed, Feb 4, 2009 at 11:10 AM, Heinrich Apfelmus
Here's a version using span from the Prelude:
main = interact $ unlines . map show . countDays . lines
countDays [] = [] countDays (day:xs) = (day, length people) : countDays xs' where (people, xs') = span (isSpace . head) xs
Ah, yes, `span` is the function I was looking for! I would have found it if I had bothered to go to Hoogle :-( /M -- Magnus Therning (OpenPGP: 0xAB4DFBA4) magnus@therning.org Jabber: magnus@therning.org http://therning.org/magnus identi.ca|twitter: magthe