Assignment 12
Due Date Mon 2/27 at 11:59pm
Possible Points 33
Purpose To begin using abstraction.
Graded Exercises
Exercise 1 Design a function that given a list of natural numbers will output 2 raised to the power of every element in the list. This function must be structurally recursive and follow the [List-of X] template (in other words, it should not use any of the functions found in table 91 or 92 of the book).
Exercise 2 Design a function that given a list of natural numbers will output the factorial of each number. Refer to assignment 7 for a definition of natural numbers. For more information on factorial, see here. This function must be structurally recursive and follow the [List-of X] template (in other words, it should not use any of the functions found in table 91 or 92 of the book).
Exercise 3 Design an abstraction apply-to-all that abstracts over these two functions. Then, comment out your past definitions and redefine them using apply-to-all. Your tests should still pass. The restriction to the above two functions also applies to this one.
Exercise 4 Use apply-to-all to design a function that takes a list of strings and appends "cat" to all of them.
Exercise 5 Give the most abstract signature for the following function:
(define (f a b c) (c (a b) b))