
Patrick LeBoutillier wrote:
Hi,
I changed my code to :
maxTableColumnWidths :: [[String]] -> [Int] maxTableColumnWidths = foldl' rowMax zeros where rowMax = zipWith (\m f -> max (length f) m) zeros = 0 : zeros
but it still blows the stack. I don't understand why. Doesn't foldl' force the evaluation of each call to rowMax? If so then I don't see what causes the stack to get so big... unless I'm looking in the wrong place...
Can anyone shed some light?
It does force the evaluation of each call to rowMax but only to weak head normal form. In other words, it will only evaluate the list to either a cons cell or an empty list blah ---> blah : blah \-> [] See also http://en.wikibooks.org/wiki/Haskell/Graph_reduction Regards, apfelmus -- http://apfelmus.nfshost.com