X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=src%2Farray.lisp;h=a15b4eb69b14369824285fbc449f03a6c2c62d37;hb=fc17cd58e6bd60aa129bb879e3cf7452a944384b;hp=b66d87c2d5b5277f2f66f68b90c1cb59cf638cfc;hpb=3b1d76c5bc0117f48e386bbf007321cde90bce5f;p=jscl.git diff --git a/src/array.lisp b/src/array.lisp index b66d87c..a15b4eb 100644 --- a/src/array.lisp +++ b/src/array.lisp @@ -13,6 +13,8 @@ ;; You should have received a copy of the GNU General Public License ;; along with JSCL. If not, see . +(/debug "loading array.lisp!") + (defun upgraded-array-element-type (typespec &optional environment) (declare (ignore environment)) (if (eq typespec 'character) @@ -73,6 +75,16 @@ (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 @@ -80,12 +92,7 @@ (and (arrayp x) (null (cdr (array-dimensions x))))) (defun vector (&rest objects) - (let* ((length (length objects)) - (array (make-array length :element-type t)) - (i 0)) - (dolist (element objects array) ;; poor-man's :initial-contents - (aset array i element) - (incf i)))) + (list-to-vector objects)) ;;; FIXME: should take optional min-extension. ;;; FIXME: should use fill-pointer instead of the absolute end of array