PS7
Home Assignments Lecture Blog Resources Project Discussion Group
Type Systems
Overview
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 https://grader.cs.uml.edu/assignments/364 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.
Reading
Before doing this problem set, read the following material:
- SICP 2.4, Multiple Representations for Abstract Data
- SICP 2.5, 2.5.1, 2.5.2, Systems with Generic Operations
Implementation
Use this starter code for completing the work.
Problems
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. 192193 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.