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

bytevector-length - the length of a bytevector

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

(bytevector-length bytevector)

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

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

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

(bytevector-length #vu8(1 2 3))
          => 3

This procedure is often used in code that deals with variable-length binary data.

This procedure works the same in all known Scheme implementations. It also appears in other languages as e.g. the len function on byte objects in Python.

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-bytevector(3scm)

R6RS, R7RS

The name first appeared in R6RS. SRFI-4 is the first SRFI to define a procedure similar to this one.

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/.

2020-12-31