Am 12.10.2004 um 18:20 schrieb Keith Wansbrough:
But if you are just learning Haskell, you almost certainly don't need
to do this. Just make use of the laziness, and learn to love it!
Thank you for your replies. You are right: I don't need it. It's just
that I am currently studying the book Algor
> main =
> let x = zipWith (+) [5..] [6..]
> in putStrLn $ show $ x `seq` head x
>
> I expected this program not to terminate - because of the seq-Operator,
> but it happily returns 11 in ghc as well as in ghci. What do I make
> wrong?
"seq" forces its argument to "Weak Head Normal
On 2004-10-12 at 18:07+0200 Christian Hofer wrote:
> Hi,
>
> having found a bit of time to play with Haskell, I am trying to figure
> out how to enforce strict evaluation.
> I wrote the following program:
>
> main =
> let x = zipWith (+) [5..] [6..]
> in putStrLn $ show $ x `seq` hea
Hi,
having found a bit of time to play with Haskell, I am trying to figure
out how to enforce strict evaluation.
I wrote the following program:
main =
let x = zipWith (+) [5..] [6..]
in putStrLn $ show $ x `seq` head x
I expected this program not to terminate - because of the seq-