Homework 8

  1. Chapter 9, problem 5
  2. Chapter 10, problem 1
  3. Chapter 10, problem 6: The problem uses Java as the language to think about. Since Java enforces variable initialization, the question doesn't make sense. Use C or C++ which don't force you to initialize variables.
  4. Show how to construct the list ((x y) z) from the individual symbols using only the cons operation.  
  5. Evaluate each of the following expressions.
    1. (cdr '(a))
    2. (cdr '((a b c) x y z))
    3. (car '((a b c) x y z))
    4. (car (cdr '((hotdogs) (pickles) (mustard ketchup))))
    5. (car (car '((hotdogs) (pickles) (mustard ketchup))))
    6. (car (cdr (cdr '((hotdogs) (pickles) (mustard ketchup)))))
     
  6. In each of the following, you are going to apply the same operation to take apart the given list. (op (op (op ... (op list)))) Show the intermediate results if you want partial credit. 
    1. How many times can you apply car before you get an atom from the list ((a b c) d e)?
    2. How many times would you have to apply cdr to the list ((b) (x y) ((c))) before you get the empty list?
  7. Chapter 15, problem 6

This assignment can be turned in

Acceptable formats for electronically submitted assignments are text, OpenOffice or MicrosoftWord. I should be able to open your assignment with OpenOffice. Unless otherwise specified in the assignment, the entire assignment should be in a single document named hwnnn with an appropriate extension.