Lisp Assignment 1

Objective

To become familiar with using the clisp interpreter interactively, and to become familiar with basic concepts of the LISP language.

Deliverables

Write out the answers to the following questions on paper and give them to me in class on May 9. (Note: These questions are based on exercises in A Programmer's Guide to Common LISP by Deborah G. Tatar, Digital Press, 1987. I recommend this book highly if you can find a copy of it.)

Questions

  1. What is the difference between typng the following items at the interpreter's top level?
    Tell what will be displayed and how the information displayed was determined by the interpreter in each case.
  2. Evaluate the following expressions.
    Be sure to check your answers using clisp before handing your work in!
  3. Write the sequence of CARs and CDRs that will pick the symbol CHAIR out of the following lists:

    You should read Chapter 15 of the Wilensky book before answering the next questions. Note that (cons 'a 'b) is the same as '(a . b). For example, the dotted-pair representation of (a b s) is (a . (b . (s . nil))). The spaces are required around the dots when you type this, by the way. The difference between a dotted pair and a list is that the cdr of each cons cell in a list is a pointer to another cons cell, except the cdr of the last cons cell, which is NIL. But a dotted pair is a cons cell with a cdr that points to something other than another cons cell (or NIL).

  4. First draw the following lists as box and pointer diagrams; then write them as dotted pairs. In the box and pointer diagrams, you can just write the Print Name of symbols instead of showing the whole 4-part structure for each symbol.
  5. Draw box and pointer diagrams for the following lists:
  6. Draw box and pointer diagrams for the following lists, dotted pairs, and combinations: