Node:Vector Accessors, Previous:Vector Creation, Up:Vectors
vectorlength
and vectorref
return information about a
given vector, respectively its size and the elements that are contained
in the vector.
vectorlength vector  Scheme Procedure 
scm_vector_length vector  C Function 
Return the number of elements in vector as an exact integer. 
vectorref vector k  Scheme Procedure 
scm_vector_ref vector k  C Function 
Return the contents of position k of vector.
k must be a valid index of vector.
(vectorref '#(1 1 2 3 5 8 13 21) 5) => 8 (vectorref '#(1 1 2 3 5 8 13 21) (let ((i (round (* 2 (acos 1))))) (if (inexact? i) (inexact>exact i) i))) => 13 
A vector created by one of the dynamic vector constructor procedures (see Vector Creation) can be modified using the following procedures.
NOTE: According to R5RS, it is an error to use any of these procedures on a literally read vector, because such vectors should be considered as constants. Currently, however, Guile does not detect this error.
vectorset! vector k obj  Scheme Procedure 
scm_vector_set_x vector k obj  C Function 
Store obj in position k of vector.
k must be a valid index of vector.
The value returned by vectorset! is unspecified.
(let ((vec (vector 0 '(2 2 2 2) "Anna"))) (vectorset! vec 1 '("Sue" "Sue")) vec) => #(0 ("Sue" "Sue") "Anna") 
vectorfill! v fill  Scheme Procedure 
scm_vector_fill_x (v, fill)  C Function 
Store fill in every position of vector. The value
returned by vectorfill! is unspecified.

vectormoveleft! vec1 start1 end1 vec2 start2  Scheme Procedure 
scm_vector_move_left_x (vec1, start1, end1, vec2, start2)  C Function 
Copy elements from vec1, positions start1 to end1,
to vec2 starting at position start2. start1 and
start2 are inclusive indices; end1 is exclusive.

vectormoveright! vec1 start1 end1 vec2 start2  Scheme Procedure 
scm_vector_move_right_x (vec1, start1, end1, vec2, start2)  C Function 
Copy elements from vec1, positions start1 to end1,
to vec2 starting at position start2. start1 and
start2 are inclusive indices; end1 is exclusive.
