vector-ref[procedure] vector-ref vector k
R5RS, R6RS: k must be a valid index of vector.
Vector-ref returns the contents of element k of vector.
Curiously, the only reference about vector access time in
R6RS is that "the average time needed to access
a randomly chosen element is typically less for the vector
than for the list." So this doesn't seem to discourage
an implementation to use non-flat structure such as trees,
or use sparse vectors. Which itself is OK, but seems
strange that R6RS explicitly mentions a constant-time
access in string-ref.
See also vector-set!.
|