(error "~S is not an array." array))
(storage-vector-set array index value))
+(define-setf-expander aref (array index)
+ (let ((g!array (gensym))
+ (g!index (gensym))
+ (g!value (gensym)))
+ (values (list g!array g!index)
+ (list array index)
+ (list g!value)
+ `(aset ,g!array ,g!index ,g!value)
+ `(aref ,g!array ,g!index))))
+
;;; Vectors
(defun nth (n list)
(car (nthcdr n list)))
+(define-setf-expander nth (n list)
+ (let ((g!list (gensym))
+ (g!index (gensym))
+ (g!value (gensym)))
+ (values (list g!list g!index)
+ (list list n)
+ (list g!value)
+ `(rplaca (nthcdr ,g!index ,g!list) ,g!value)
+ `(nth ,g!index ,g!list))))
+
(defun caar (x) (car (car x)))
(defun cadr (x) (car (cdr x)))
(defun cdar (x) (cdr (car x)))