Assignment 12
SML and Exception Handling
Due April 27th, 9:30 a.m.
(Must be done with your group)
- For the following patterns, describe what they match:
- h1::h2::nil
- h1::h2::t
- 1::2::t
- "Hi"::"There"::nil
- 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]).
- Page 577, Problem set, Problem 9 (ps: the
question says "...following Java skeletal program" but the program really uses
C++ syntax and semantics).
- Give an example program that illustrates the usefulness of the "finally" part of
Java's try-catch-finally statement. Explain your example.