CS 22
CS 22 -- Homework 9
Due: Monday, 11 Feb.
- Read pp. 113-124
- Finish Clab 9 (do not hand in--just do it!)
- Email solutions and evidence of testing for:
- page 77, exs. 1.41, 1.42, 1.43
- page 103, ex. 2.18
- 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)) ==> ()
- 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 / '() '()) ==> ()
- page 110-111, exs. 2.27, 2.28