vector-length(3scm) Scheme Programmer's Manual vector-length(3scm)

vector-length - the length of a vector

(import (rnrs))                     ;R6RS
(import (rnrs base))                ;R6RS
(import (scheme r5rs))              ;R7RS
(import (scheme base))              ;R7RS

(vector-length vector)

Returns, as an exact integer object, the number of elements in vector. The length of a vector is fixed.

All extant implementations use fixnums to represent vector lengths, but this is not required.

Returns a single value which is the length of the vector.

(vector-length '#(1 2 3))
          => 3

The vector-length procedure sometimes appears in code that destructures vectors, but in such cases it may be better to use a pattern matching library such as (chibi match).

Apart from error handling, this procedure is the same in all Scheme reports.

This procedure can raise exceptions with the following condition types:
&assertion (R6RS)
The wrong number of arguments was passed or an argument was outside its domain.
R7RS
The assertions described above are errors. Implementations may signal an error, extend the procedure's domain of definition to include such arguments, or fail catastrophically.

make-vector(3scm), vector-ref(3scm), length(3scm).

R4RS, IEEE Scheme, R5RS, R6RS, R7RS

This page is part of the scheme-manpages project. It includes materials from the RnRS documents. More information can be found at https://weinholt.se/scheme/manpages/.

2021-01-03