Recitation 7

  1. The textbook mentions namespaces and encapsulation as two of the features that module systems can provide. How does the OCaml module system provide these features?

  2. Suppose you implement a functional aka persistent stack data structure based on singly-linked lists in an imperative language like Java or Python. How would that implementation differ from a more typical mutable implementation? Would the efficiency of any operations be affected?

  3. In the stack and queue implementations in the textbook, there are two implementations: one in which some operations raise exceptions, and another in which some operations return options. Which do you prefer, and why?