Skip to content

Latest commit

 

History

History
13 lines (10 loc) · 635 Bytes

vector-push.md

File metadata and controls

13 lines (10 loc) · 635 Bytes

vector-push

(vector-push value vector)

Stores value at the fill pointer of a vector created with make-array :fill-pointer, increments the fill pointer and returns the index the value was stored at, or nil (leaving the vector untouched) when the vector is already full. Use vector-push-extend to grow the vector instead. A vector without a fill pointer signals a type-error (fill-pointer).

(defparameter *v* (make-array 2 :fill-pointer 0))
(vector-push 10 *v*) ; => 0
(vector-push 20 *v*) ; => 1
(vector-push 30 *v*) ; => NIL
*v* ; => #(10 20)