;;; VECTORS 1: MAKE-ARRAY, AREF, AND #(...) (solution) (defun slot-one (v) (aref v 1)) (defun replace-first (v x) (setf (aref v 0) x) v) (defun triple-vector (a b c) (vector a b c)) ;;; ------------------------------------------------------------------ ;;; Checks. Read them - they tell you what to aim for - but leave ;;; them unchanged. ;;; ------------------------------------------------------------------ (check-equal 'b (slot-one #(a b c))) (check-equal 2 (slot-one #(1 2 3))) (check-equal 'x (aref (replace-first (make-array 2 :initial-element 'a) 'x) 0)) (check-equal 99 (aref (replace-first (make-array 3 :initial-element 0) 99) 0)) (check (vectorp (triple-vector 'a 'b 'c))) (check (equalp #(p q r) (triple-vector 'p 'q 'r))) (check-equal 'q (aref (triple-vector 'p 'q 'r) 1)) (check-equal 3 (length #(a b c)))