Functions: self-assessment exercise

Beacuse the answers can now be so varied it no longer seems appropriate to fill in boxes. Instead, below are listed some exercises which you should try to answer by typing definitions into a Lisp interpreter and trying them out. If you want to see an answer, just press the button next to the question.
A function that given a list of lists, reverses both the contents of the inner lists and the list of lists. You will probably need an auxiliary function.
A function that accepts a variable number of arguments and returns a count of how many arguments it receives. You could use the defined function size, although you can also solve this using recursion and apply.
A function that given two lists of the same length, returns a list in which the elements are taken alternately from the first and the second list
A function that given a function and two lists of the same length, returns a list in which the elements are the result of the application of the function to the corresponding elements of the two lists.
Modify the previous function (call it abc) such that (abc (lambda (e1 e2 r) (cons e1 (cons e2 r))) l1 l2) produces the same answer as the function you defined for exercise 3.
Use the function defined in exercise 5 to compute the sum of two lists of numbers by means of a suitable anonymous function.
An iterative version of the power function which works by repeated squaring.
your answer to exercise 7 can be optimised further. Notice that once the exponent is even, it will remain so until it reaches 1. Hence we can simplify the program by splitting it into two functions: one for even exponents and one for odd exponents. Write this new version.

Julian Padget, jap@maths.bath.ac.uk, this version December 7, 1994