
Chris Kuklewicz wrote:
What does lazy printing mean?
I assume it means you evaluate the head of the list, print it, then recursively do this for the tail of the list. With an infinite list you will get inifinite output.
I assume it does not mean you evaluate the whole list before printing anything. This would prevent infinite lists from producing output.
Yes, that's exactly what I had in mind. I wanted to print [1..] (an infinite list) with each number on a different line. Thanks for the help. Yes, the function works now.
main = do let hw = ["Hello"," ","World","!"] mapM_ putStr hw mapM_ putStrLn hw putStr (unlines hw) -- see also: unwords, words, lines printList hw
Cool. I didn't know about (un)words and unlines. Cheers, Daniel. -- /\/`) http://oooauthors.org /\/_/ http://opendocumentfellowship.org /\/_/ \/_/ I am not over-weight, I am under-tall. /