Home Assignments Lecture Blog Resources Project Discussion Group

Type Systems


This problem set introduces three ways to build type systems in Scheme: generic operations with explicit dispatch, data-directed style, and message-passing style.

Please retrieve starter files from and submit your work there.

Note: this assignment is not autograded. Please put your code and associated explanations in a clear form for our TA to manually grade in the indicated place in each starter file.


Before doing this problem set, read the following material:


Use this starter code for completing the work.


1. Exercise 2.76 on pp. 187, a discussion of the three strategies presented in the text. Before answering the questions, briefly define the three strategies.

2. Exercise 2.77 on pp. 192–193 on complex-number selectors in type table.

3. Exercise 2.78 on pp. 193, implementing our scheme-number type natively.

4. Exercise 2.79 on pp. 193, implementing a generic equality predicate.

5. Exercise 2.81 on pp. 200, fixing apply-generic so that it doesn't coerce two arguments of the same type.

Extra Credit and Graduate Students

6. Exercise 2.83 on pp. 201, raising objects’ type per the “tower of types.”

7. Exercise 2.84 on pp. 201, modifying apply-generic to coerce arguments to a higher type in the tower.