First Lisp Assignment

due: Wednesday, 2/9/00

 
 

As with all programming assignments in this class, you may not use global variables in your solutions unless explicitly permitted by the instructor.  Use a LET construct to declare and define local variables as you need them.
 

What to hand in:

At the beginning of class, please turn in a hard-copy showing your source code, and a brief session trace demonstrating that your functions work as specified.  Also, submit the same file(s) via the electronic homework submission system at http://bunter.cs.emich.edu/~hwmatt/student before class.
 
  1. Write a function, FOO, that takes two arguments, A and B, and returns (not prints!) a list of the form (A B (B A) A B).

  2. For example:  (foo 1 '(x y)) should return (1 (x y) ((x y) 1) 1 (x y))
     
  3. Write a function, BAR, that takes two arguments, A and B, assumed to be integers, and returns A raised to the Bth power.  If A and B are not both integers, BAR should print a warning message, and return 1.  For this problem you may not use Lisp's built-in expt function.  You should use DOTIMES to calculate the result via iteration.  You'll probably have to use LET to solve this problem.

  4. For example: (bar 2 3) should return 8, while  (bar 3 3) should return 27.