
3 Jan
2006
3 Jan
'06
1:30 p.m.
On 1/3/06, Daniel Carrera
Neil Mitchell wrote:
All Haskell functions are lazy, hence there is no need to "write a lazy version" of your print_list function. I think the function you probably want is:
putStr (unlines xs)
Hhmm... that does work, and I'm a bit surprised that it does. I guess I'm still stuck in the eager computation mindset. I would expect putStr to have to wait for the (unlines xs) to be finished before doing any printing, but it doesn't.
Some day I'll get the hang of this lazy evaluation thing. :)
It does, in a sense, but since unlines is lazy (just like *everything else* in Haskell) it won't actually *do* anything until putStr demands an element from the result. /S -- Sebastian Sylvan +46(0)736-818655 UIN: 44640862