CSE 413

Quiz #3

4/18/97


1. (2 pts.) We could define a "binary list" to be one in which every element is either a 0 or a 1. Define a LISP function 'binp' which returns T if its argument is a binary list and returns nil otherwise.

(binp '(0 0 1 1 0))

T

(binp 0)

nil

(binp '(0 (1 0)))

nil

  

 


2. (1/2 pt. each) Suppose A has the value 'a, B has the value 'b, X has the value '(1 2 3), and Y has the value '(4 5 6).

What is the value of each of the following expressions (or is there an error):

  1. (cons A X)
  2. (cons X A)
  3. (append A X)
  4. (append X Y)
  5. (list A B)
  6. (list X A)


3. (2 pts. ) Which of the following names or concepts would one expect to encounter when studying the lambda calculus? Circle all that apply (-1 for each mistake, up to -2).