CIS 352   —   SPRING 2008

Homework 6


Coverage

This homework covers material in Chapter 3 of Essentials of Programming Languages (EOPL).

Logistics

This homework is due in the bin in CST 3-212 by noon on Friday, March 7.

You may work singly or in pairs on this assignment.


EXERCISES

For this assignment, you'll need a copy of the file interp-3-5.scm which is the interpreter discussed in class.

  1. (25 points) EOPL, Exercises 3.11, 3.12, and 3.17 (no need to answer the testing question).

    Note that the 3.7 portion (mentioned in 3.12 and 3.17) is really from Lab 6, but you'll need them to adequately test your answers.


  2. (15 points) EOPL, Exercise 3.13.


  3. (15 points) EOPL, Exercise 3.18.

    As an example of its usage, the following code should evaluate to 68, because 5 + 7 9 = 68:

    unpack a b c d = cons(5,cdr(list(6,7,8,9))) 
     in +(a,*(b,d))
    In contrast, the following code should result in an error:
    unpack a b c d = cons(5,cdr(list(6,7,8,9,10))) 
     in +(a,*(b,d))


  4. (15 points) EOPL, Exercise 3.20.


  5. (20 points) EOPL, Exercise 3.29.

    At a minimum, the entry message should include both the formal and actual parameters, and the exit message should include the result. As an example, the result of evaluating

    let tester = traceproc (x,y) *(v,+(x,y)) 
     in (tester 3 4)
    should look something like the following:
    --> let tester = traceproc (x,y) *(v,+(x,y)) in (tester 3 4)
    entering procedure with parameters: x=3 y=4
    leaving procedure, with result: 35
    35
    -->
    
    Note that the second 35 is the value of the entire expression.

A few hints/suggestions:
Back to the CIS 352 Homepage
Jim Royer /