wiley_pastebin icon

CS6 W8 L1 Hakell and Lazy Evaluation 8

wiley_pastebin | PRO | 01/13/20 09:31:30 AM UTC | 0 ⭐ | 12923 👁️ | Never ⏰ | []
Haskell |

400 B

|

None

|

0 👍

/

0 👎

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

  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎

    
        
  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎