(setf vec (make-array 4 :initial-element nil))
(svref vec 0)
In the above snippet we create a vector of length 4 and access its elements by (svref vec ).
(vector 1 2 3 4 5)
In the above snippet we create a vector of length 5 using vector function. How do we access the elements of this vector? How svref is used for this vector?
The generic vector reference function is
aref, the same as for all other arrays.Svrefis only for simple vectors, i. e. vectors withelement-typet, not adjustable, no fill-pointer, not displaced.By the way,
vectordoes produce a simple vector, sosvrefshould work for your second example, too.Other issues:
:initial-element.