CS 314 Prof Steinberg Fall 2005 Exercise Set 3 In all of the following use recursion and binding, not iteration and assignment. 1. Write a scheme function filter-evens which takes a list of numbers as its argument and returns a a new list containing only the even numbers in the input list. E.g., (filter-evens '(23 33 44 2 1 8)) returns (44 2 8). use even? to test if a number is even. 2. Write a scheme function sep-lines that prints the elements of a list, starting each on a new line. E.g. (sep-lines '((a b) c d (e g g))) prints: (a b) c d (e f g) Use (display #\newline) to print a new line character. 3. Write a scheme function mtable that prints a multiplication table. E.g. (mtable 6) prints 1 2 3 4 5 6 2 4 6 8 10 12 3 6 9 12 15 18 4 8 12 16 20 24 5 10 15 20 25 30 6 12 18 24 30 36 4. Write a scheme function deep-reverse which reverses all levels of list in its argument. E.g., (deep-reverse '((a b c) d (e (f g)))) returns (((g f) e) d (c b a)) 5. Write a scheme function square-all which takes a list of numbers and returns a list of their squares. E.g., (square-all '(3 5 2)) returns (9 25 4). Use map to do so. 6. Write a scheme function (assoc-all lst a-list) where lst is a list of symbols and a-list is an assoc-list. assoc-all returns a list of the data associated with elements of lst by assoc-list. E.g., (assoc-all '(a d c) '((a apple)(b boy)(c cat)(d dog))) returns (apple dog cat). Use map. Note that you can't simply use assoc as one of the arguments to map. You need a lambda.