
5 Feb
2009
5 Feb
'09
4:58 a.m.
Magnus Therning wrote:
isSection line = not . isSpace . head $ line
I'ld be more careful with "head"! Imagine your binary fails with: Prelude.head: empty list
countDays [] = [] countDays ls = let day = head ls count = length $ takeWhile (isSpace . head) $ tail ls in (day, count) : countDays (drop (1 + count) ls)
here too, and better use a pattern like: ls@(hd, tl) Cheers Christian