MCS-388 Homework 4 (Spring 2005)

Due: April 12, 2005

  1. Do exercise 5.3 on page 336. However, modify the problem to use - (subtraction) in place of + (addition).

  2. Do exercise 8.12 on page 509. To generate concrete code, you need to know the answers to several questions: For all these questions, feel free to either pick some concrete numbers (like the 10x20), state them, and then work using them, or give symbolic names to the quantities (like saying the array is NxM, with K bytes per element) and then give answers that have expressions containing these symbolic names, even when they really would be crunched down to a single constant. You also need to make a choice of whether the arrays are stored in row-major or column-major order.

  3. Write three programs in Scheme. The first should be such that a compiler could use static allocation for all of the program's variables. The second should be such that static allocation would not work for all the variables, but stack allocation would. The third should be such that even stack allocation wouldn't work; instead, the compiler will need to use heap allocation for at least some of the variables.

Course web site:
Instructor: Max Hailperin <>