- Title
- vector-push
- Type
- Function
- Arguments
- vector-push NEW-ELEMENT VECTOR
- Package
- lisp
- Section
- 配列
- File
- builtin.l
ベクタ(一次元配列) VECTOR のフィルポインタの次の位置に
新しい要素 NEW-ELEMENT を追加します。
VECTOR はフィルポインタを持っているベクタである必要があります。
フィルポインタが VECTOR の最後に達している場合には何もせず nil を返します。
使用例:
;; フィルポインタがベクタの長さに一致
(setf x (make-vector 5 :initial-contents '(a b c d e) :fill-pointer t))
=> #(a b c d e)
(fill-pointer x)
=> 5
(vector-push 'xyz x)
=> nil
x
=>#(a b c d e)
;; フィルポインタがベクタの長さより小さい
(setf x (make-vector 5 :initial-contents '(a b c d e) :fill-pointer 3))
=> #(a b c)
(fill-pointer x)
=> 3
(vector-push 'xyz x)
=> 3
x
=> #(a b c xyz)
- Seealso
- fill-pointer
- vector-pop
- vector-push-extend