Next: , Previous: , Up: srfi vector spec   [Index]


2.23.4.4 Selectors

Function: vector-ref vec i -> value

R5RS Vector element dereferencing: return the value that the location in vec at i is mapped to in the store. Indexing is based on zero. The argument i must be within the range: [0, (vector-length vec)).

Example:

(vector-ref '#(a b c d) 2)
=> c
Function: vector-length vec -> exact nonnegative integer

R5RS Return the length of vec, the number of locations reachable from vec. (The careful word “reachable” is used to allow for “vector slices”, whereby vec refers to a larger vector that contains more locations that are unreachable from vec. This SRFI does not define vector slices, but later SRFIs may.)

Example:

(vector-length '#(a b c))
=> 3