;Here are the questions for the Lisp Quiz (for COSC 159). ;Question numbers are omitted so that this file can be fed ;directly into the CLISP interpreter. ;The order of the expressions may vary on the actual quiz. ;Write how the CLISP interpreter would respond to each ;of the following input expressions (this quiz, like the ;lisp interpreter, is not case-sensitive). (length '(1 2 (1 1))) (first '(a b c)) (rest '(a b c)) (cons 'a 'b) (cons 'a '(b)) (list 'a 'b) (list '(a b) '(a c)) (append '(a b) '(a c)) (progn (defun one (x y) (+ x (* 3 y))) (one 5 4) ) (let ((s '(2 3 1))) (cond ((null s) "empty") ((eq (first s) 2) "good") (t "great")) ) (progn (setq n 7) (if (evenp n) (+ n 1) (+ n 2)) ) (null nil) (null '(())) (let ((x 1)) (let ((x 2)) (princ x)) (princ x)) (funcall #'(lambda (x) (* 3 x x)) 4) (reverse '((a b) b c a)) (eq '(2) '(2)) (eq '2 '2) (equal '(2) '(2)) (member 2 '(1 2 3)) (member '(1 2) '((0 4) (1 3)) :test #'(lambda (x y) (eq (first x) (first y))) ) (mapcar #'+ '(1 2 3) '(4 5 6)) (reduce #'list '(1 2 3 4)) (mapcar #'(lambda (x) (* x x)) '(1 2 3 4)) (dotimes (i 5) (princ i)) (progn (defun itersqr (f x) (funcall f (funcall f x))) (itersqr #'sqrt 256) ) (progn (setq s1 '(a b c)) (setq s2 '(d e)) (setf (second s1) s2) s1 ) (princ (+ 2 3)) (do ((nums '(4 12 3 6 7 8 21) (rest nums)) (ans nil (if (evenp (first nums)) (cons (first nums) ans) ans) )) ((null nums) ans))