CS 22

CS 22 -- Homework 9


Due: Monday, 11 Feb.

  1. Read pp. 113-124
  2. Finish Clab 9 (do not hand in--just do it!)
  3. Email solutions and evidence of testing for:
    1. page 77, exs. 1.41, 1.42, 1.43
    2. page 103, ex. 2.18
    3. Write a procedure called pairwise-map that takes a procedure of two arguments and a list, and then executes the procedure on successive pairs in the list returning the results in a new list.
      (pairwise-map + '(2 3 4 5 7)) ==> (5 7 9 12)
      (pairwise-map max '(2 4 3 5 4 1)) ==> (4 4 5 5 4)
      (pairwise-map * '(2)) ==> ()
    4. Write a procedure called map2 that takes a procedure of two arguments and two lists, and then executes the procedure on successive elements of the lists returning the results in a list.
      (map2 + '(1 2 3 4) '(4 3 2 1)) ==> (5 5 5 5)
      (map2 * '(3 3 3) '(4 3 2)) ==> (12 9 6)
      (map2 / '() '()) ==> ()
    5. page 110-111, exs. 2.27, 2.28