Advertisement
wiley_pastebin

CS6 W8 L1 Hakell and Lazy Evaluation 8

Jan 13th, 2020
801
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. 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
  2. x^2 + 4*x + 4 where x = 13       -- the result of Haskell evaluating x
  3. 13^2 + 4*x + 4 where x = 13      -- Haskell can now plug the value of x in every time the value is needed
  4. 169 + 4*x + 4 where x = 13
  5. 169 + 4*13 + 4 where x = 13
  6. 169 + 52 + 4 where x = 13
  7. 225 where x = 13
  8. 225
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement