Hi! > The list of tuples _does_ need to be strict. Beyond that, as Ketil Malde > said, you should not use foldl -- instead, foldl' is the best version to > use when you are recalculating the result every time a new list item is > processed.
Thanks! I did the following: merge [] x = [(x,1)] merge (e@(a,b):xs) x | x == a = let b' = b+1 in b' `seq` (a,b'):xs | otherwise = e : merge xs x foldl' f z xs = lgo z xs where lgo z [] = z lgo z (x:xs) = (lgo $! (f z x)) xs procFile = putStrLn . show . foldl' merge [] . words and it works! But I wonder why the very useful function foldl' as I define it is not included into Prelude? I think, many people work with large lists or streams... -- Alexander Kogan Institute of Applied Physics Russian Academy of Sciences _______________________________________________ Haskell-Cafe mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/haskell-cafe