(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)
(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
(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)))
(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)