Assignment 12
SML and Exception Handling
Due April 27th, 9:30 a.m.
(Must be done with your group)

  1. For the following patterns, describe what they match:
    1. h1::h2::nil
    2. h1::h2::t
    3. 1::2::t
    4. "Hi"::"There"::nil
  2. Write a polymorphic SML function powerset that given a set (represented as a list) will return the set of all its subsets.  For example, if you give it the list [1,2,3], it returns [[], [1]. [2]. [3]. [1,2], [1,3], [2,3],[1,2,3]] (note: the order of the elements within a list is not important for this question, e.g.,. [1,2,3] is equivalent to [2,1,3]). 
  3. Page 577, Problem set, Problem 9 (ps: the question says "...following Java skeletal program" but the program really uses C++ syntax and semantics).
  4. Give an example program that illustrates the usefulness of the "finally" part of Java's try-catch-finally statement.  Explain your example.