Sonoma State University
Department of Computer Science
CS-460: Programming Languages
Exercise 11a

Objective:

Please enter the following Common Lisp program before answering the questions below:

(defun elem (n l)
(cond ((null l) nil)
((= n 0) (car l))
(t (elem (- n 1) (cdr l)))))

Instructions:

With your team, enter the output from the following Common Lisp statements:

  1. (car (list 'apple 'banana 'plum 'mango 'strawberry))
  2. (cdr (list 'apple 'banana 'plum 'mango 'strawberry))
  3. (car (cdr (list 'apple 'banana 'plum 'mango 'strawberry)))
  4. (car (cdr (cdr (list 'apple 'banana 'plum 'mango 'strawberry))))
  5. (cons 'passion\ fruit (list 'apple 'banana 'plum 'mango 'strawberry))
  6. (elem 1 '(passion\ fruit apple banana plum mango strawberry))
  7. (elem 5 '(passion\ fruit apple banana plum mango strawberry))
  8. (elem 6 '(passion\ fruit apple banana plum mango strawberry))

Submitting your solution:

Since this is a group assignment, please write the names of each member of your team on your assignment submission along with "Exercise 11a".