X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=src%2Fcode%2Farray.lisp;h=3e9474086ef25367148cc4d16c38ccb9bd725d37;hb=212ef8043aeaceaa627f2924e04554fbc37b8ee1;hp=e5f56e66918c3e940f9bcb7663dbe2b8ed4d0243;hpb=c3f281f5c34b55170ac43a4679f1528b8bb7c703;p=sbcl.git diff --git a/src/code/array.lisp b/src/code/array.lisp index e5f56e6..3e94740 100644 --- a/src/code/array.lisp +++ b/src/code/array.lisp @@ -11,9 +11,6 @@ (in-package "SB!IMPL") -(file-comment - "$Header$") - #!-sb-fluid (declaim (inline fill-pointer array-has-fill-pointer-p adjustable-array-p array-displacement)) @@ -619,13 +616,13 @@ (defun array-has-fill-pointer-p (array) #!+sb-doc - "Returns T if the given Array has a fill pointer, or Nil otherwise." + "Return T if the given ARRAY has a fill pointer, or NIL otherwise." (declare (array array)) (and (array-header-p array) (%array-fill-pointer-p array))) (defun fill-pointer (vector) #!+sb-doc - "Returns the Fill-Pointer of the given Vector." + "Return the FILL-POINTER of the given VECTOR." (declare (vector vector)) (if (and (array-header-p vector) (%array-fill-pointer-p vector)) (%array-fill-pointer vector) @@ -640,8 +637,9 @@ (declare (vector vector) (fixnum new)) (if (and (array-header-p vector) (%array-fill-pointer-p vector)) (if (> new (%array-available-elements vector)) - (error "New fill pointer, ~S, is larger than the length of the vector." - new) + (error + "The new fill pointer, ~S, is larger than the length of the vector." + new) (setf (%array-fill-pointer vector) new)) (error 'simple-type-error :datum vector @@ -651,9 +649,9 @@ (defun vector-push (new-el array) #!+sb-doc - "Attempts to set the element of Array designated by the fill pointer - to New-El and increment fill pointer by one. If the fill pointer is - too large, Nil is returned, otherwise the index of the pushed element is + "Attempt to set the element of ARRAY designated by its fill pointer + to NEW-EL, and increment the fill pointer by one. If the fill pointer is + too large, NIL is returned, otherwise the index of the pushed element is returned." (declare (vector array)) (let ((fill-pointer (fill-pointer array))) @@ -665,20 +663,20 @@ (setf (%array-fill-pointer array) (1+ fill-pointer)) fill-pointer)))) -(defun vector-push-extend (new-el array &optional - (extension (if (zerop (length array)) - 1 - (length array)))) +(defun vector-push-extend (new-element + vector + &optional + (extension (1+ (length vector)))) #!+sb-doc "Like Vector-Push except that if the fill pointer gets too large, the - Array is extended rather than Nil being returned." - (declare (vector array) (fixnum extension)) - (let ((fill-pointer (fill-pointer array))) + Vector is extended rather than Nil being returned." + (declare (vector vector) (fixnum extension)) + (let ((fill-pointer (fill-pointer vector))) (declare (fixnum fill-pointer)) - (when (= fill-pointer (%array-available-elements array)) - (adjust-array array (+ fill-pointer extension))) - (setf (aref array fill-pointer) new-el) - (setf (%array-fill-pointer array) (1+ fill-pointer)) + (when (= fill-pointer (%array-available-elements vector)) + (adjust-array vector (+ fill-pointer extension))) + (setf (aref vector fill-pointer) new-element) + (setf (%array-fill-pointer vector) (1+ fill-pointer)) fill-pointer)) (defun vector-pop (array)