CIS 352   —   SPRING 2009

Homework 2


Coverage

This homework covers material in

Logistics

What to Turn in:


EXERCISES

  1. (12 points) EOPL, Exercise 1.16

  2. (16 points) EOPL, Exercise 1.18

  3. (16 points) EOPL, Exercise 1.21

  4. (12 points) EOPL, Exercise 1.23     ⇐ CHANGED!!!

  5. (12 points) EOPL, Exercise 1.24

  6. (16 points) EOPL, Exercise 1.27

  7. (16 points) Write a Scheme procedure compose-all that takes an arbitrary number of 1-argument procedures and returns their composition. For example, compose-all should have the following behavior:

    > (define my-caddr (compose-all car cdr cdr)) 
    > (my-caddr '(a b c d e)) 
    c 
    
    > (define plus1 (lambda (x) (+ x 1))) 
    > (define times10 (lambda (y) (* y 10))) 
    > ((compose-all times10 times10 plus1 plus1) 3) 
    500
    
    > ((compose-all) 17) 
    17 
    Note: The result of composing 0 procedures is the identity procedure (i.e., the procedure that returns the value of its argument).

Back to the CIS 352 Homepage
Jim Royer /