Lisp Quiz Preparation Sheet
What will be returned by each of the following?
(setq b (car a))
Given the 2 statements above, which of the following statements will produce the following list which has the 2nd and 4th elements interchanged (1 4 3 2)
(append b (reverse (cdr a)))
(cons b (reverse (cdr a)))
(list b (reverse (cdr a)))
Will any of them work for a longer original list such as (1 2 3 4 5 6 7)?
(not nil)
(or ())
(or (t nil))
(or 3 4 5)
(and 3 4 5)
(and t nil 7)
(or t nil 7)
7. (atom Mary)
( defun mystery (a b)
(cond
((> a b) a)
(( > b a ) b)
(t (* (+ b b) (+ a a)))
)
)
Given the function mystery above, what will be returned by
(mystery 2 3)
(mystery 7 -12)
(mystery 5 5)