CS6 W8 L1 Hakell and Lazy Evaluation 8
x^2 + 4*x + 4 where x = fibs !! 1000 `mod` 17 --Haskell evaluates a sum left to right. Haskell needs to know what x is x^2 + 4*x + 4 where x = 13 -- the result of Haskell evaluating x 13^2 + 4*x + 4 where x = 13 -- Haskell can now plug the value of x in every time the value is needed 169 + 4*x + 4 where x = 13 169 + 4*13 + 4 where x = 13 169 + 52 + 4 where x = 13 225 where x = 13 225
Comments
0 B
|👍
/👎
0 B
|👍
/👎