Learning Module 17 — State and Objects

Why this is important: We do like Haskell, but we’re also realists. We know that you’re likely to use languages that have destructive update. It turns out that some interesting things happen if you combine this with closures. You can even implement your own object oriented system with it.

Outcomes

  • 17.1 – Define a function that has “local state” in a language like Python. (5 points)
  • 17.2 – Implement a simple inheritance system using local state. (3 points)
  • 17.3 – Give an example of a covariant and contravariant type relationship. (2 points)
Previous
Next