Sonoma State University
Department of Computer Science
CS-460: Programming Languages
Exercise 12b

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)))))

In a team of three or four students, 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 include the names of each member of your team along with "Exercise 12b" when submitting your solution.