Recitation 5

  1. Compare and constrast OCaml’s 'a list with Java’s LinkedList<E>. Focus on the types, especially how you create and access values of each type.

  2. Pick another language you know, and identify all the kinds of each-of and one-of types that it has. Does it have any maybe (i.e., option) types?

  3. Explain how Java references are similar to OCaml options. Focus on how you would access the contents of an option vs. a reference, and what exceptions could be raised. Why do you think the Java designers chose not to explicitly use options? In your opinion, did they make the right tradeoff?

(As always, submit your answers to CMS; we won’t bother to mention that from now on.)