;; Solution to 3c (defun rotate-3 (alist n) (append (nthcdr n alist) (butlast alist (- (length alist) n)) ) ) ;; Solution to 3b (defun rotate-2 (alist n) (if (= n 0) alist (rotate-2 (append (rest alist) (list (first alist))) (- n 1)) ) ) ;; Solution to 3a (defun rotate-left-by-n (alist n) (dotimes (i (mod n (length alist)) alist) (setf alist (append (rest alist) (list (first alist)))) ) ) ;; Solution to 2 (defun identity-p (amatrix) (let ( (result t) ) (dotimes (i (array-dimension amatrix 0) result) (dotimes (j (array-dimension amatrix 0)) (if (= i j) (if (not (= (aref amatrix i j) 1)) (setf result nil) ) (if (not (= (aref amatrix i j) 0)) (setf result nil) ) ) ) ) ) )