1. SRFI-160: Homogeneous numeric vector libraries
    1. Abstract
    2. Rationale
    3. Specification
    4. Additions to the specification
    5. Notation
    6. Packaging
    7. Procedures
      1. Constructors
      2. Predicates
      3. Selectors
      4. Iteration
      5. Searching
      6. Mutators
      7. Conversion
      8. Generators
      9. Comparators
      10. Output
    8. The SRFI 160 base library
    9. Acknowledgements
    10. Authors
    11. Maintainer
    12. Repository
    13. Copyright
    14. Version history

SRFI-160: Homogeneous numeric vector libraries

Abstract

This SRFI describes a set of operations on SRFI 4 homogeneous vector types (plus a few additional types) that are closely analogous to the vector operations library, SRFI 133. An external representation is specified which may be supported by the read and write procedures and by the program parser so that programs can contain references to literal homogeneous vectors.

For more information see: SRFI-160: Homogeneous numeric vector libraries

Rationale

Like lists, Scheme vectors are a heterogeneous datatype which impose no restriction on the type of the elements. This generality is not needed for applications where all the elements are of the same type. The use of Scheme vectors is not ideal for such applications because, in the absence of a compiler with a fancy static analysis, the representation will typically use some form of boxing of the elements which means low space efficiency and slower access to the elements. Moreover, homogeneous vectors are convenient for interfacing with low-level libraries (e.g. binary block I/O) and to interface with foreign languages which support homogeneous vectors. Finally, the use of homogeneous vectors allows certain errors to be caught earlier.

This SRFI specifies a set of homogeneous vector datatypes which cover the most practical cases, that is where the type of the elements is numeric (exact integer or inexact real or complex) and the precision and representation is efficiently implemented on the hardware of most current computer architectures (8, 16, 32 and 64 bit integers, either signed or unsigned, and 32 and 64 bit floating point numbers).

This SRFI extends SRFI 4 by providing the additional c64vector and c128vector types, and by providing analogues for almost all of the heterogeneous vector procedures of SRFI 133. There are some additional procedures, most of which are closely analogous to the string procedures of SRFI 152.

Note that there are no conversions between homogeneous vectors and strings in this SRFI. In addition, there is no support for u1vectors (bitvectors) provided, not because they are not useful, but because they are different enough in both specification and implementation to be put into a future SRFI of their own.

Specification

There are eight datatypes of exact integer homogeneous vectors (which will be called integer vectors):

All are part of SRFI 4.

There are two datatypes of inexact real homogeneous vectors (which will be called float vectors):

These are also part of SRFI 4.

f64vectors must preserve at least as much precision and range as f32vectors. (See the implementation section for details.)

And there are two datatypes of inexact complex homogeneous vectors (which will be called complex vectors):

[type] c64vector

inexact complex, typically 64 bits

[type] c128vector

inexact complex, typically 128 bits

These are not part of SRFI 4.

c128vectors must preserve at least as much precision and range as c64vectors. (See the implementation section for details.)

Each element of a homogeneous vector must be valid. That is, for an integer vector, it must be an exact integer within the inclusive range specified above; for a float vector, it must be an inexact real number; and for a complex vector, it must be an inexact complex number. It is an error to try to use a constructor or mutator to set an element to an invalid value.

Additions to the specification

The CHICKEN implementation adds a couple of features to the SRFI specification. It prints c64vector and c128vector as #!c64(...) and #!c128(...), respectively, with the appropriate sharp-read-syntax '#!c64(...) and '#!c128(...).

It also exports the following two procedures for access to the underlying srfi-4 vectors that make up the body of complex vectors:

[procedure] (c128vector-body c128vec)

Returns the f64vector body of c128vec.

[procedure] (c64vector-body c64vec)

Returns the f32vector body of c64vec.

Notation

So as not to multiply the number of procedures described in this SRFI beyond necessity, a special notational convention is used. The description of the procedure make-@vector is really shorthand for the descriptions of the twelve procedures make-s8vector, make-u8vector, ... make-c128vector, all of which are exactly the same except that they construct different homogeneous vector types. Furthermore, except as otherwise noted, the semantics of each procedure are those of the corresponding SRFI 133 procedure, except that it is an error to attempt to insert an invalid value into a homogeneous vector. Consequently, only a brief description of each procedure is given, and SRFI 133 (or in some cases SRFI 152) should be consulted for the details. It is worth mentioning, however, that all the procedures that return one or more vectors (homogeneous or heterogeneous) invariably return newly allocated vectors specifically.

In the section containing specifications of procedures, the following notation is used to specify parameters and return values:

vec
Must be a heterogeneous vector, i.e. it must satisfy the predicate vector?.
@vec, @to, @from
Must be a homogeneous vector, i.e. it must satisfy the predicate @vector?. In @vector-copy! and reverse-@vector-copy!, @to is the destination and @from is the source.
i, j, start, at
Must be an exact-nonnegative-integer less than the length of the @vector. In @vector-copy! and reverse-@vector-copy!, at refers to the destination and start to the source.
end
Must be an exact-nonnegative-integer not less than start and not greater than the length of the vector. This indicates the index directly before which traversal will stop -- processing will occur until the index of the vector is one less than end. It is the open right side of a range.
f
Must be a procedure taking one or more arguments, which returns (except as noted otherwise) exactly one value.
pred
Must be a procedure taking one or more arguments that returns one value, which is treated as a boolean.
=
Must be an equivalence procedure.
obj, seed, knil
A scheme object.
fill, value
Any number that is valid with respect to the @vec.
[something]
An optional argument; it needn't necessarily be applied. Something needn't necessarily be one thing; for example, this usage of it is perfectly valid: [start [end]] and is indeed used quite often.
something ...
Zero or more somethings are allowed to be arguments.
something[1] something[2] ...
At least one something must be arguments.

Packaging

For each @vector type, there is a corresponding library named (srfi 160 @), and if an implementation provides a given type, it must provide that library as well. In addition, the library (srfi 160 base) provides a few basic procedures for all @vector types. If a particular type is not provided by an implementation, then it is an error to call the corresponding procedures in this library. Note that there is no library named (srfi 160).

Procedures

The procedures shared with SRFI 4 are marked with SRFI 4. The procedures with the same semantics as SRFI 133 are marked with SRFI 133. The procedures analogous to SRFI 152 string procedures are marked with SRFI 152.

Constructors

[procedure] (make-u8vector size [fill]) -> @vector
[procedure] (make-s8vector size [fill]) -> @vector
[procedure] (make-u16vector size [fill]) -> @vector
[procedure] (make-s16vector size [fill]) -> @vector
[procedure] (make-u32vector size [fill]) -> @vector
[procedure] (make-s32vector size [fill]) -> @vector
[procedure] (make-u64vector size [fill]) -> @vector
[procedure] (make-s64vector size [fill]) -> @vector
[procedure] (make-f32vector size [fill]) -> @vector
[procedure] (make-f64vector size [fill]) -> @vector
[procedure] (make-c64vector size [fill]) -> @vector
[procedure] (make-c128vector size [fill]) -> @vector

Returns a @vector whose length is size. If fill is provided, all the elements of the @vector are initialized to it.

SRFI 4

[procedure] (u8vector value ...) -> @vector
[procedure] (s8vector value ...) -> @vector
[procedure] (u16vector value ...) -> @vector
[procedure] (s16vector value ...) -> @vector
[procedure] (u32vector value ...) -> @vector
[procedure] (s32vector value ...) -> @vector
[procedure] (u64vector value ...) -> @vector
[procedure] (s64vector value ...) -> @vector
[procedure] (f32vector value ...) -> @vector
[procedure] (f64vector value ...) -> @vector
[procedure] (c64vector value ...) -> @vector
[procedure] (c128vector value ...) -> @vector

Returns a @vector initialized with values.

SRFI 4

[procedure] (u8vector-unfold f length seed) -> @vector
[procedure] (s8vector-unfold f length seed) -> @vector
[procedure] (u16vector-unfold f length seed) -> @vector
[procedure] (s16vector-unfold f length seed) -> @vector
[procedure] (u32vector-unfold f length seed) -> @vector
[procedure] (s32vector-unfold f length seed) -> @vector
[procedure] (u64vector-unfold f length seed) -> @vector
[procedure] (s64vector-unfold f length seed) -> @vector
[procedure] (f32vector-unfold f length seed) -> @vector
[procedure] (f64vector-unfold f length seed) -> @vector
[procedure] (c64vector-unfold f length seed) -> @vector
[procedure] (c128vector-unfold f length seed) -> @vector

Creates a vector whose length is length and iterates across each index k between 0 and length - 1, applying f at each iteration to the current index and current state, in that order, to receive two values: the element to put in the kth slot of the new vector and a new state for the next iteration. On the first call to f, the state's value is seed.

SRFI 133

[procedure] (u8vector-unfold-right f length seed) -> @vector
[procedure] (s8vector-unfold-right f length seed) -> @vector
[procedure] (u16vector-unfold-right f length seed) -> @vector
[procedure] (s16vector-unfold-right f length seed) -> @vector
[procedure] (u32vector-unfold-right f length seed) -> @vector
[procedure] (s32vector-unfold-right f length seed) -> @vector
[procedure] (u64vector-unfold-right f length seed) -> @vector
[procedure] (s64vector-unfold-right f length seed) -> @vector
[procedure] (f32vector-unfold-right f length seed) -> @vector
[procedure] (f64vector-unfold-right f length seed) -> @vector
[procedure] (c64vector-unfold-right f length seed) -> @vector
[procedure] (c128vector-unfold-right f length seed) -> @vector

The same as @vector-unfold, but initializes the @vector from right to left.

SRFI 133

[procedure] (u8vector-copy @vec [start [end]]) -> @vector
[procedure] (s8vector-copy @vec [start [end]]) -> @vector
[procedure] (u16vector-copy @vec [start [end]]) -> @vector
[procedure] (s16vector-copy @vec [start [end]]) -> @vector
[procedure] (u32vector-copy @vec [start [end]]) -> @vector
[procedure] (s32vector-copy @vec [start [end]]) -> @vector
[procedure] (u64vector-copy @vec [start [end]]) -> @vector
[procedure] (s64vector-copy @vec [start [end]]) -> @vector
[procedure] (f32vector-copy @vec [start [end]]) -> @vector
[procedure] (f64vector-copy @vec [start [end]]) -> @vector
[procedure] (c64vector-copy @vec [start [end]]) -> @vector
[procedure] (c128vector-copy @vec [start [end]]) -> @vector

Makes a copy of the portion of @vec from start to end and returns it.

SRFI 133

[procedure] (u8vector-reverse-copy @vec [start [end]]) -> @vector
[procedure] (s8vector-reverse-copy @vec [start [end]]) -> @vector
[procedure] (u16vector-reverse-copy @vec [start [end]]) -> @vector
[procedure] (s16vector-reverse-copy @vec [start [end]]) -> @vector
[procedure] (u32vector-reverse-copy @vec [start [end]]) -> @vector
[procedure] (s32vector-reverse-copy @vec [start [end]]) -> @vector
[procedure] (u64vector-reverse-copy @vec [start [end]]) -> @vector
[procedure] (s64vector-reverse-copy @vec [start [end]]) -> @vector
[procedure] (f32vector-reverse-copy @vec [start [end]]) -> @vector
[procedure] (f64vector-reverse-copy @vec [start [end]]) -> @vector
[procedure] (c64vector-reverse-copy @vec [start [end]]) -> @vector
[procedure] (c128vector-reverse-copy @vec [start [end]]) -> @vector

The same as @vector-copy, but in reverse order.

SRFI 133

[procedure] (u8vector-append @vec ...) -> @vector
[procedure] (s8vector-append @vec ...) -> @vector
[procedure] (u16vector-append @vec ...) -> @vector
[procedure] (s16vector-append @vec ...) -> @vector
[procedure] (u32vector-append @vec ...) -> @vector
[procedure] (s32vector-append @vec ...) -> @vector
[procedure] (u64vector-append @vec ...) -> @vector
[procedure] (s64vector-append @vec ...) -> @vector
[procedure] (f32vector-append @vec ...) -> @vector
[procedure] (f64vector-append @vec ...) -> @vector
[procedure] (c64vector-append @vec ...) -> @vector
[procedure] (c128vector-append @vec ...) -> @vector

Returns a @vector containing all the elements of the @vecs in order.

SRFI 133

[procedure] (u8vector-concatenate list-of-@vectors) -> @vector
[procedure] (s8vector-concatenate list-of-@vectors) -> @vector
[procedure] (u16vector-concatenate list-of-@vectors) -> @vector
[procedure] (s16vector-concatenate list-of-@vectors) -> @vector
[procedure] (u32vector-concatenate list-of-@vectors) -> @vector
[procedure] (s32vector-concatenate list-of-@vectors) -> @vector
[procedure] (u64vector-concatenate list-of-@vectors) -> @vector
[procedure] (s64vector-concatenate list-of-@vectors) -> @vector
[procedure] (f32vector-concatenate list-of-@vectors) -> @vector
[procedure] (f64vector-concatenate list-of-@vectors) -> @vector
[procedure] (c64vector-concatenate list-of-@vectors) -> @vector
[procedure] (c128vector-concatenate list-of-@vectors) -> @vector

SRFI 133

The same as @vector-append, but takes a list of @vectors rather than multiple arguments.

[procedure] (u8vector-append-subvectors [@vec start end] ...) -> @vector
[procedure] (s8vector-append-subvectors [@vec start end] ...) -> @vector
[procedure] (u16vector-append-subvectors [@vec start end] ...) -> @vector
[procedure] (s16vector-append-subvectors [@vec start end] ...) -> @vector
[procedure] (u32vector-append-subvectors [@vec start end] ...) -> @vector
[procedure] (s32vector-append-subvectors [@vec start end] ...) -> @vector
[procedure] (u64vector-append-subvectors [@vec start end] ...) -> @vector
[procedure] (s64vector-append-subvectors [@vec start end] ...) -> @vector
[procedure] (f32vector-append-subvectors [@vec start end] ...) -> @vector
[procedure] (f64vector-append-subvectors [@vec start end] ...) -> @vector
[procedure] (c64vector-append-subvectors [@vec start end] ...) -> @vector
[procedure] (c128vector-append-subvectors [@vec start end] ...) -> @vector

Concatenates the result of applying @vector-copy to each triplet of @vec, start, end arguments, but may be implemented more efficiently.

SRFI 133

Predicates

[procedure] (u8? obj) -> boolean
[procedure] (s8? obj) -> boolean
[procedure] (u16? obj) -> boolean
[procedure] (s16? obj) -> boolean
[procedure] (u32? obj) -> boolean
[procedure] (s32? obj) -> boolean
[procedure] (u64? obj) -> boolean
[procedure] (s64? obj) -> boolean
[procedure] (f32? obj) -> boolean
[procedure] (f64? obj) -> boolean
[procedure] (c64? obj) -> boolean
[procedure] (c128? obj) -> boolean

Returns #t if obj is a valid element of an @vector, and #f otherwise.

[procedure] (u8vector? obj) -> boolean
[procedure] (s8vector? obj) -> boolean
[procedure] (u16vector? obj) -> boolean
[procedure] (s16vector? obj) -> boolean
[procedure] (u32vector? obj) -> boolean
[procedure] (s32vector? obj) -> boolean
[procedure] (u64vector? obj) -> boolean
[procedure] (s64vector? obj) -> boolean
[procedure] (f32vector? obj) -> boolean
[procedure] (f64vector? obj) -> boolean
[procedure] (c64vector? obj) -> boolean
[procedure] (c128vector? obj) -> boolean

Returns #t if obj is a @vector, and #f otherwise.

SRFI 4

[procedure] (u8vector-empty? @vec) -> boolean
[procedure] (s8vector-empty? @vec) -> boolean
[procedure] (u16vector-empty? @vec) -> boolean
[procedure] (s16vector-empty? @vec) -> boolean
[procedure] (u32vector-empty? @vec) -> boolean
[procedure] (s32vector-empty? @vec) -> boolean
[procedure] (u64vector-empty? @vec) -> boolean
[procedure] (s64vector-empty? @vec) -> boolean
[procedure] (f32vector-empty? @vec) -> boolean
[procedure] (f64vector-empty? @vec) -> boolean
[procedure] (c64vector-empty? @vec) -> boolean
[procedure] (c128vector-empty? @vec) -> boolean

Returns #t if @vec has a length of zero, and #f otherwise.

SRFI 133

[procedure] (u8vector= @vec ...) -> boolean
[procedure] (s8vector= @vec ...) -> boolean
[procedure] (u16vector= @vec ...) -> boolean
[procedure] (s16vector= @vec ...) -> boolean
[procedure] (u32vector= @vec ...) -> boolean
[procedure] (s32vector= @vec ...) -> boolean
[procedure] (u64vector= @vec ...) -> boolean
[procedure] (s64vector= @vec ...) -> boolean
[procedure] (f32vector= @vec ...) -> boolean
[procedure] (f64vector= @vec ...) -> boolean
[procedure] (c64vector= @vec ...) -> boolean
[procedure] (c128vector= @vec ...) -> boolean

Compares the @vecs for elementwise equality, using = to do the comparisons. Returns #f unless all @vectors are the same length.

SRFI 133

Selectors

[procedure] (u8vector-ref @vec i) -> value
[procedure] (s8vector-ref @vec i) -> value
[procedure] (u16vector-ref @vec i) -> value
[procedure] (s16vector-ref @vec i) -> value
[procedure] (u32vector-ref @vec i) -> value
[procedure] (s32vector-ref @vec i) -> value
[procedure] (u64vector-ref @vec i) -> value
[procedure] (s64vector-ref @vec i) -> value
[procedure] (f32vector-ref @vec i) -> value
[procedure] (f64vector-ref @vec i) -> value
[procedure] (c64vector-ref @vec i) -> value
[procedure] (c128vector-ref @vec i) -> value

Returns the ith element of @vec.

SRFI 4

[procedure] (u8vector-length @vec) -> exact-nonnegative-integer
[procedure] (s8vector-length @vec) -> exact-nonnegative-integer
[procedure] (u16vector-length @vec) -> exact-nonnegative-integer
[procedure] (s16vector-length @vec) -> exact-nonnegative-integer
[procedure] (u32vector-length @vec) -> exact-nonnegative-integer
[procedure] (s32vector-length @vec) -> exact-nonnegative-integer
[procedure] (u64vector-length @vec) -> exact-nonnegative-integer
[procedure] (s64vector-length @vec) -> exact-nonnegative-integer
[procedure] (f32vector-length @vec) -> exact-nonnegative-integer
[procedure] (f64vector-length @vec) -> exact-nonnegative-integer
[procedure] (c64vector-length @vec) -> exact-nonnegative-integer
[procedure] (c128vector-length @vec) -> exact-nonnegative-integer

Returns the length of @vec

SRFI 4

Iteration

[procedure] (u8vector-take @vec n) -> @vector
[procedure] (s8vector-take @vec n) -> @vector
[procedure] (u16vector-take @vec n) -> @vector
[procedure] (s16vector-take @vec n) -> @vector
[procedure] (u32vector-take @vec n) -> @vector
[procedure] (s32vector-take @vec n) -> @vector
[procedure] (u64vector-take @vec n) -> @vector
[procedure] (s64vector-take @vec n) -> @vector
[procedure] (f32vector-take @vec n) -> @vector
[procedure] (f64vector-take @vec n) -> @vector
[procedure] (c64vector-take @vec n) -> @vector
[procedure] (c128vector-take @vec n) -> @vector

Returns a @vector containing the first n elements of @vec.

SRFI 152

[procedure] (u8vector-take-right @vec n) -> @vector
[procedure] (s8vector-take-right @vec n) -> @vector
[procedure] (u16vector-take-right @vec n) -> @vector
[procedure] (s16vector-take-right @vec n) -> @vector
[procedure] (u32vector-take-right @vec n) -> @vector
[procedure] (s32vector-take-right @vec n) -> @vector
[procedure] (u64vector-take-right @vec n) -> @vector
[procedure] (s64vector-take-right @vec n) -> @vector
[procedure] (f32vector-take-right @vec n) -> @vector
[procedure] (f64vector-take-right @vec n) -> @vector
[procedure] (c64vector-take-right @vec n) -> @vector
[procedure] (c128vector-take-right @vec n) -> @vector

Returns a @vector containing the last n elements of @vec.

SRFI 152

[procedure] (u8vector-drop @vec n) -> @vector
[procedure] (s8vector-drop @vec n) -> @vector
[procedure] (u16vector-drop @vec n) -> @vector
[procedure] (s16vector-drop @vec n) -> @vector
[procedure] (u32vector-drop @vec n) -> @vector
[procedure] (s32vector-drop @vec n) -> @vector
[procedure] (u64vector-drop @vec n) -> @vector
[procedure] (s64vector-drop @vec n) -> @vector
[procedure] (f32vector-drop @vec n) -> @vector
[procedure] (f64vector-drop @vec n) -> @vector
[procedure] (c64vector-drop @vec n) -> @vector
[procedure] (c128vector-drop @vec n) -> @vector

Returns a @vector containing all except the first n elements of @vec.

SRFI 152

[procedure] (u8vector-drop-right @vec n) -> @vector
[procedure] (s8vector-drop-right @vec n) -> @vector
[procedure] (u16vector-drop-right @vec n) -> @vector
[procedure] (s16vector-drop-right @vec n) -> @vector
[procedure] (u32vector-drop-right @vec n) -> @vector
[procedure] (s32vector-drop-right @vec n) -> @vector
[procedure] (u64vector-drop-right @vec n) -> @vector
[procedure] (s64vector-drop-right @vec n) -> @vector
[procedure] (f32vector-drop-right @vec n) -> @vector
[procedure] (f64vector-drop-right @vec n) -> @vector
[procedure] (c64vector-drop-right @vec n) -> @vector
[procedure] (c128vector-drop-right @vec n) -> @vector

Returns a @vector containing all except the last n elements of @vec.

SRFI 152

[procedure] (u8vector-segment @vec n) -> list
[procedure] (s8vector-segment @vec n) -> list
[procedure] (u16vector-segment @vec n) -> list
[procedure] (s16vector-segment @vec n) -> list
[procedure] (u32vector-segment @vec n) -> list
[procedure] (s32vector-segment @vec n) -> list
[procedure] (u64vector-segment @vec n) -> list
[procedure] (s64vector-segment @vec n) -> list
[procedure] (f32vector-segment @vec n) -> list
[procedure] (f64vector-segment @vec n) -> list
[procedure] (c64vector-segment @vec n) -> list
[procedure] (c128vector-segment @vec n) -> list

Returns a list of @vectors, each of which contains n consecutive elements of @vec. The last @vector may be shorter than n.

SRFI 152

[procedure] (u8vector-fold kons knil @vec @vec2 ...) -> object
[procedure] (s8vector-fold kons knil @vec @vec2 ...) -> object
[procedure] (u16vector-fold kons knil @vec @vec2 ...) -> object
[procedure] (s16vector-fold kons knil @vec @vec2 ...) -> object
[procedure] (u32vector-fold kons knil @vec @vec2 ...) -> object
[procedure] (s32vector-fold kons knil @vec @vec2 ...) -> object
[procedure] (u64vector-fold kons knil @vec @vec2 ...) -> object
[procedure] (s64vector-fold kons knil @vec @vec2 ...) -> object
[procedure] (f32vector-fold kons knil @vec @vec2 ...) -> object
[procedure] (f64vector-fold kons knil @vec @vec2 ...) -> object
[procedure] (c64vector-fold kons knil @vec @vec2 ...) -> object
[procedure] (c128vector-fold kons knil @vec @vec2 ...) -> object

When one @vector argument @vec is given, folds kons over the elements of @vec in increasing order using knil as the initial value. The kons procedure is called with the state first and the element second, as in SRFIs 43 and 133 (heterogeneous vectors). This is the opposite order to that used in SRFI 1 (lists) and the various string SRFIs.

When multiple @vector arguments are given, kons is called with the current state value and each value from all the vectors; @vector-fold scans elements from left to right. If the lengths of vectors differ, only the portion of each vector up to the length of the shortest vector is scanned.

SRFI 133

[procedure] (u8vector-fold-right kons knil @vec @vec2 ...) -> object
[procedure] (s8vector-fold-right kons knil @vec @vec2 ...) -> object
[procedure] (u16vector-fold-right kons knil @vec @vec2 ...) -> object
[procedure] (s16vector-fold-right kons knil @vec @vec2 ...) -> object
[procedure] (u32vector-fold-right kons knil @vec @vec2 ...) -> object
[procedure] (s32vector-fold-right kons knil @vec @vec2 ...) -> object
[procedure] (u64vector-fold-right kons knil @vec @vec2 ...) -> object
[procedure] (s64vector-fold-right kons knil @vec @vec2 ...) -> object
[procedure] (f32vector-fold-right kons knil @vec @vec2 ...) -> object
[procedure] (f64vector-fold-right kons knil @vec @vec2 ...) -> object
[procedure] (c64vector-fold-right kons knil @vec @vec2 ...) -> object
[procedure] (c128vector-fold-right kons knil @vec @vec2 ...) -> object

When one @vector argument @vec is given, folds kons over the elements of @vec in decreasing order using knil as the initial value. The kons procedure is called with the state first and the element second, as in SRFIs 43 and 133 (heterogeneous vectors). This is the opposite order to that used in SRFI 1 (lists) and the various string SRFIs.

When multiple @vector arguments are given, kons is called with the current state value and each value from all the vectors; @vector-fold-right scans elements from right to left. If the lengths of vectors differ, only the portion of each vector up to the length of the shortest vector is scanned.

SRFI 133

[procedure] (u8vector-map f @vec @vec2 ...) -> @vector
[procedure] (s8vector-map f @vec @vec2 ...) -> @vector
[procedure] (u16vector-map f @vec @vec2 ...) -> @vector
[procedure] (s16vector-map f @vec @vec2 ...) -> @vector
[procedure] (u32vector-map f @vec @vec2 ...) -> @vector
[procedure] (s32vector-map f @vec @vec2 ...) -> @vector
[procedure] (u64vector-map f @vec @vec2 ...) -> @vector
[procedure] (s64vector-map f @vec @vec2 ...) -> @vector
[procedure] (f32vector-map f @vec @vec2 ...) -> @vector
[procedure] (f64vector-map f @vec @vec2 ...) -> @vector
[procedure] (c64vector-map f @vec @vec2 ...) -> @vector
[procedure] (c128vector-map f @vec @vec2 ...) -> @vector

Iterate over the elements of @vec and apply f to each, returning a @vector of the results.

If more than one vector is passed, f gets one element from each vector as arguments. If the lengths of the vectors differ, iteration stops at the end of the shortest vector.

If @vector-map returns more than once (i.e. because of a continuation captured by f), the values returned or stored by earlier returns may be mutated.

SRFI 133

[procedure] (u8vector-map! f @vec @vec2 ...) -> unspecified
[procedure] (s8vector-map! f @vec @vec2 ...) -> unspecified
[procedure] (u16vector-map! f @vec @vec2 ...) -> unspecified
[procedure] (s16vector-map! f @vec @vec2 ...) -> unspecified
[procedure] (u32vector-map! f @vec @vec2 ...) -> unspecified
[procedure] (s32vector-map! f @vec @vec2 ...) -> unspecified
[procedure] (u64vector-map! f @vec @vec2 ...) -> unspecified
[procedure] (s64vector-map! f @vec @vec2 ...) -> unspecified
[procedure] (f32vector-map! f @vec @vec2 ...) -> unspecified
[procedure] (f64vector-map! f @vec @vec2 ...) -> unspecified
[procedure] (c64vector-map! f @vec @vec2 ...) -> unspecified
[procedure] (c128vector-map! f @vec @vec2 ...) -> unspecified

Iterate over the elements of @vec and apply f to each, returning an undefined value with the results placed back in @vec.

If more than one vector is passed, f gets one element from each vector as arguments. If the lengths of the vectors differ, iteration stops at the end of the shortest vector. Only @vec is modified even when multiple vectors are passed.

If @vector-map! returns more than once (i.e. because of a continuation captured by f), the values returned or stored by earlier returns may be mutated.

SRFI 133

[procedure] (u8vector-for-each f @vec @vec2 ...) -> unspecified
[procedure] (s8vector-for-each f @vec @vec2 ...) -> unspecified
[procedure] (u16vector-for-each f @vec @vec2 ...) -> unspecified
[procedure] (s16vector-for-each f @vec @vec2 ...) -> unspecified
[procedure] (u32vector-for-each f @vec @vec2 ...) -> unspecified
[procedure] (s32vector-for-each f @vec @vec2 ...) -> unspecified
[procedure] (u64vector-for-each f @vec @vec2 ...) -> unspecified
[procedure] (s64vector-for-each f @vec @vec2 ...) -> unspecified
[procedure] (f32vector-for-each f @vec @vec2 ...) -> unspecified
[procedure] (f64vector-for-each f @vec @vec2 ...) -> unspecified
[procedure] (c64vector-for-each f @vec @vec2 ...) -> unspecified
[procedure] (c128vector-for-each f @vec @vec2 ...) -> unspecified

Iterate over the elements of @vec and apply f to each, returning an undefined value with no change to the passed @vecs.

If more than one vector is passed, f gets one element from each vector as arguments. If the lengths of the vectors differ, iteration stops at the end of the shortest vector.

SRFI 133

[procedure] (u8vector-count pred? @vec @vec2 ...) -> exact-nonnegative-integer
[procedure] (s8vector-count pred? @vec @vec2 ...) -> exact-nonnegative-integer
[procedure] (u16vector-count pred? @vec @vec2 ...) -> exact-nonnegative-integer
[procedure] (s16vector-count pred? @vec @vec2 ...) -> exact-nonnegative-integer
[procedure] (u32vector-count pred? @vec @vec2 ...) -> exact-nonnegative-integer
[procedure] (s32vector-count pred? @vec @vec2 ...) -> exact-nonnegative-integer
[procedure] (u64vector-count pred? @vec @vec2 ...) -> exact-nonnegative-integer
[procedure] (s64vector-count pred? @vec @vec2 ...) -> exact-nonnegative-integer
[procedure] (f32vector-count pred? @vec @vec2 ...) -> exact-nonnegative-integer
[procedure] (f64vector-count pred? @vec @vec2 ...) -> exact-nonnegative-integer
[procedure] (c64vector-count pred? @vec @vec2 ...) -> exact-nonnegative-integer
[procedure] (c128vector-count pred? @vec @vec2 ...) -> exact-nonnegative-integer

Call pred? on each element of @vec and return the number of calls that return true.

When multiple vectors are given, pred? must take the same number of arguments as the number of vectors, and corresponding elements from each vector are given for each iteration, which stops at the end of the shortest vector.

SRFI 133

[procedure] (u8vector-cumulate f knil @vec) -> @vector
[procedure] (s8vector-cumulate f knil @vec) -> @vector
[procedure] (u16vector-cumulate f knil @vec) -> @vector
[procedure] (s16vector-cumulate f knil @vec) -> @vector
[procedure] (u32vector-cumulate f knil @vec) -> @vector
[procedure] (s32vector-cumulate f knil @vec) -> @vector
[procedure] (u64vector-cumulate f knil @vec) -> @vector
[procedure] (s64vector-cumulate f knil @vec) -> @vector
[procedure] (f32vector-cumulate f knil @vec) -> @vector
[procedure] (f64vector-cumulate f knil @vec) -> @vector
[procedure] (c64vector-cumulate f knil @vec) -> @vector
[procedure] (c128vector-cumulate f knil @vec) -> @vector

Like @vector-fold, but returns an @vector of partial results rather than just the final result.

SRFI 133

Searching

[procedure] (u8vector-take-while pred? @vec) -> @vector
[procedure] (s8vector-take-while pred? @vec) -> @vector
[procedure] (u16vector-take-while pred? @vec) -> @vector
[procedure] (s16vector-take-while pred? @vec) -> @vector
[procedure] (u32vector-take-while pred? @vec) -> @vector
[procedure] (s32vector-take-while pred? @vec) -> @vector
[procedure] (u64vector-take-while pred? @vec) -> @vector
[procedure] (s64vector-take-while pred? @vec) -> @vector
[procedure] (f32vector-take-while pred? @vec) -> @vector
[procedure] (f64vector-take-while pred? @vec) -> @vector
[procedure] (c64vector-take-while pred? @vec) -> @vector
[procedure] (c128vector-take-while pred? @vec) -> @vector

Return the shortest prefix of @vec all of whose elements satisfy pred?.

SRFI 152

[procedure] (u8vector-take-while-right pred? @vec) -> @vector
[procedure] (s8vector-take-while-right pred? @vec) -> @vector
[procedure] (u16vector-take-while-right pred? @vec) -> @vector
[procedure] (s16vector-take-while-right pred? @vec) -> @vector
[procedure] (u32vector-take-while-right pred? @vec) -> @vector
[procedure] (s32vector-take-while-right pred? @vec) -> @vector
[procedure] (u64vector-take-while-right pred? @vec) -> @vector
[procedure] (s64vector-take-while-right pred? @vec) -> @vector
[procedure] (f32vector-take-while-right pred? @vec) -> @vector
[procedure] (f64vector-take-while-right pred? @vec) -> @vector
[procedure] (c64vector-take-while-right pred? @vec) -> @vector
[procedure] (c128vector-take-while-right pred? @vec) -> @vector

Return the shortest suffix of @vec all of whose elements satisfy pred?.

SRFI 152

[procedure] (u8vector-drop-while pred? @vec) -> @vector
[procedure] (s8vector-drop-while pred? @vec) -> @vector
[procedure] (u16vector-drop-while pred? @vec) -> @vector
[procedure] (s16vector-drop-while pred? @vec) -> @vector
[procedure] (u32vector-drop-while pred? @vec) -> @vector
[procedure] (s32vector-drop-while pred? @vec) -> @vector
[procedure] (u64vector-drop-while pred? @vec) -> @vector
[procedure] (s64vector-drop-while pred? @vec) -> @vector
[procedure] (f32vector-drop-while pred? @vec) -> @vector
[procedure] (f64vector-drop-while pred? @vec) -> @vector
[procedure] (c64vector-drop-while pred? @vec) -> @vector
[procedure] (c128vector-drop-while pred? @vec) -> @vector

Drops the longest initial prefix of @vec such that all its elements satisfy pred.

SRFI 152

[procedure] (u8vector-drop-while-right pred? @vec) -> @vector
[procedure] (s8vector-drop-while-right pred? @vec) -> @vector
[procedure] (u16vector-drop-while-right pred? @vec) -> @vector
[procedure] (s16vector-drop-while-right pred? @vec) -> @vector
[procedure] (u32vector-drop-while-right pred? @vec) -> @vector
[procedure] (s32vector-drop-while-right pred? @vec) -> @vector
[procedure] (u64vector-drop-while-right pred? @vec) -> @vector
[procedure] (s64vector-drop-while-right pred? @vec) -> @vector
[procedure] (f32vector-drop-while-right pred? @vec) -> @vector
[procedure] (f64vector-drop-while-right pred? @vec) -> @vector
[procedure] (c64vector-drop-while-right pred? @vec) -> @vector
[procedure] (c128vector-drop-while-right pred? @vec) -> @vector

Drops the longest initial suffix of @vec such that all its elements satisfy pred.

SRFI 152

[procedure] (u8vector-index pred? @vec @vec2 ...) -> (or exact-nonnegative-integer #f)
[procedure] (s8vector-index pred? @vec @vec2 ...) -> (or exact-nonnegative-integer #f)
[procedure] (u16vector-index pred? @vec @vec2 ...) -> (or exact-nonnegative-integer #f)
[procedure] (s16vector-index pred? @vec @vec2 ...) -> (or exact-nonnegative-integer #f)
[procedure] (u32vector-index pred? @vec @vec2 ...) -> (or exact-nonnegative-integer #f)
[procedure] (s32vector-index pred? @vec @vec2 ...) -> (or exact-nonnegative-integer #f)
[procedure] (u64vector-index pred? @vec @vec2 ...) -> (or exact-nonnegative-integer #f)
[procedure] (s64vector-index pred? @vec @vec2 ...) -> (or exact-nonnegative-integer #f)
[procedure] (f32vector-index pred? @vec @vec2 ...) -> (or exact-nonnegative-integer #f)
[procedure] (f64vector-index pred? @vec @vec2 ...) -> (or exact-nonnegative-integer #f)
[procedure] (c64vector-index pred? @vec @vec2 ...) -> (or exact-nonnegative-integer #f)
[procedure] (c128vector-index pred? @vec @vec2 ...) -> (or exact-nonnegative-integer #f)

Return the index of the first element of @vec that satisfies pred?.

When multiple vectors are passed, pred? must take the same number of arguments as the number of vectors, and corresponding elements from each vector are passed for each iteration. If the lengths of vectors differ, iteration stops at the end of the shortest one.

SRFI 133

[procedure] (u8vector-index-right pred? @vec @vec2 ...) -> (or exact-nonnegative-integer #f)
[procedure] (s8vector-index-right pred? @vec @vec2 ...) -> (or exact-nonnegative-integer #f)
[procedure] (u16vector-index-right pred? @vec @vec2 ...) -> (or exact-nonnegative-integer #f)
[procedure] (s16vector-index-right pred? @vec @vec2 ...) -> (or exact-nonnegative-integer #f)
[procedure] (u32vector-index-right pred? @vec @vec2 ...) -> (or exact-nonnegative-integer #f)
[procedure] (s32vector-index-right pred? @vec @vec2 ...) -> (or exact-nonnegative-integer #f)
[procedure] (u64vector-index-right pred? @vec @vec2 ...) -> (or exact-nonnegative-integer #f)
[procedure] (s64vector-index-right pred? @vec @vec2 ...) -> (or exact-nonnegative-integer #f)
[procedure] (f32vector-index-right pred? @vec @vec2 ...) -> (or exact-nonnegative-integer #f)
[procedure] (f64vector-index-right pred? @vec @vec2 ...) -> (or exact-nonnegative-integer #f)
[procedure] (c64vector-index-right pred? @vec @vec2 ...) -> (or exact-nonnegative-integer #f)
[procedure] (c128vector-index-right pred? @vec @vec2 ...) -> (or exact-nonnegative-integer #f)

Return the index of the last element of @vec that satisfies pred?.

When multiple vectors are passed, pred? must take the same number of arguments as the number of vectors, and corresponding elements from each vector are passed for each iteration. Lengths of vectors must be the same.

SRFI 133

[procedure] (u8vector-skip pred? @vec @vec2 ...) -> (or exact-nonnegative-integer #f)
[procedure] (s8vector-skip pred? @vec @vec2 ...) -> (or exact-nonnegative-integer #f)
[procedure] (u16vector-skip pred? @vec @vec2 ...) -> (or exact-nonnegative-integer #f)
[procedure] (s16vector-skip pred? @vec @vec2 ...) -> (or exact-nonnegative-integer #f)
[procedure] (u32vector-skip pred? @vec @vec2 ...) -> (or exact-nonnegative-integer #f)
[procedure] (s32vector-skip pred? @vec @vec2 ...) -> (or exact-nonnegative-integer #f)
[procedure] (u64vector-skip pred? @vec @vec2 ...) -> (or exact-nonnegative-integer #f)
[procedure] (s64vector-skip pred? @vec @vec2 ...) -> (or exact-nonnegative-integer #f)
[procedure] (f32vector-skip pred? @vec @vec2 ...) -> (or exact-nonnegative-integer #f)
[procedure] (f64vector-skip pred? @vec @vec2 ...) -> (or exact-nonnegative-integer #f)
[procedure] (c64vector-skip pred? @vec @vec2 ...) -> (or exact-nonnegative-integer #f)
[procedure] (c128vector-skip pred? @vec @vec2 ...) -> (or exact-nonnegative-integer #f)

Returns the index of the first element of @vec that does not satisfy pred?.

When multiple vectors are passed, pred? must take the same number of arguments as the number of vectors, and corresponding elements from each vector are passed for each iteration. If the lengths of vectors differ, iteration stops at the end of the shortest one.

SRFI 133

[procedure] (u8vector-skip-right pred? @vec @vec2 ...) -> (or exact-nonnegative-integer #f)
[procedure] (s8vector-skip-right pred? @vec @vec2 ...) -> (or exact-nonnegative-integer #f)
[procedure] (u16vector-skip-right pred? @vec @vec2 ...) -> (or exact-nonnegative-integer #f)
[procedure] (s16vector-skip-right pred? @vec @vec2 ...) -> (or exact-nonnegative-integer #f)
[procedure] (u32vector-skip-right pred? @vec @vec2 ...) -> (or exact-nonnegative-integer #f)
[procedure] (s32vector-skip-right pred? @vec @vec2 ...) -> (or exact-nonnegative-integer #f)
[procedure] (u64vector-skip-right pred? @vec @vec2 ...) -> (or exact-nonnegative-integer #f)
[procedure] (s64vector-skip-right pred? @vec @vec2 ...) -> (or exact-nonnegative-integer #f)
[procedure] (f32vector-skip-right pred? @vec @vec2 ...) -> (or exact-nonnegative-integer #f)
[procedure] (f64vector-skip-right pred? @vec @vec2 ...) -> (or exact-nonnegative-integer #f)
[procedure] (c64vector-skip-right pred? @vec @vec2 ...) -> (or exact-nonnegative-integer #f)
[procedure] (c128vector-skip-right pred? @vec @vec2 ...) -> (or exact-nonnegative-integer #f)

Returns the index of the last element of @vec that does not satisfy pred?.

When multiple vectors are passed, pred? must take the same number of arguments as the number of vectors, and corresponding elements from each vector are passed for each iteration. Lengths of vectors must be the same.

SRFI 133

[procedure] (u8vector-any pred? @vec @vec2 ...) -> (or value boolean)
[procedure] (s8vector-any pred? @vec @vec2 ...) -> (or value boolean)
[procedure] (u16vector-any pred? @vec @vec2 ...) -> (or value boolean)
[procedure] (s16vector-any pred? @vec @vec2 ...) -> (or value boolean)
[procedure] (u32vector-any pred? @vec @vec2 ...) -> (or value boolean)
[procedure] (s32vector-any pred? @vec @vec2 ...) -> (or value boolean)
[procedure] (u64vector-any pred? @vec @vec2 ...) -> (or value boolean)
[procedure] (s64vector-any pred? @vec @vec2 ...) -> (or value boolean)
[procedure] (f32vector-any pred? @vec @vec2 ...) -> (or value boolean)
[procedure] (f64vector-any pred? @vec @vec2 ...) -> (or value boolean)
[procedure] (c64vector-any pred? @vec @vec2 ...) -> (or value boolean)
[procedure] (c128vector-any pred? @vec @vec2 ...) -> (or value boolean)

Returns first non-false result of applying pred? on a element from the @vec, or #f if there is no such element. If @vec is empty, returns #t

When multiple vectors are passed, pred? must take the same number of arguments as the number of vectors, and corresponding elements from each vector are passed for each iteration. If the lengths of vectors differ, it stops at the end of the shortest one.

SRFI 133

[procedure] (u8vector-every pred? @vec @vec2 ...) -> (or value boolean)
[procedure] (s8vector-every pred? @vec @vec2 ...) -> (or value boolean)
[procedure] (u16vector-every pred? @vec @vec2 ...) -> (or value boolean)
[procedure] (s16vector-every pred? @vec @vec2 ...) -> (or value boolean)
[procedure] (u32vector-every pred? @vec @vec2 ...) -> (or value boolean)
[procedure] (s32vector-every pred? @vec @vec2 ...) -> (or value boolean)
[procedure] (u64vector-every pred? @vec @vec2 ...) -> (or value boolean)
[procedure] (s64vector-every pred? @vec @vec2 ...) -> (or value boolean)
[procedure] (f32vector-every pred? @vec @vec2 ...) -> (or value boolean)
[procedure] (f64vector-every pred? @vec @vec2 ...) -> (or value boolean)
[procedure] (c64vector-every pred? @vec @vec2 ...) -> (or value boolean)
[procedure] (c128vector-every pred? @vec @vec2 ...) -> (or value boolean)

If all elements from @vec satisfy pred?, return the last result of pred?. If not all do, return #f. If @vec is empty, return #t

When multiple vectors are passed, pred? must take the same number of arguments as the number of vectors, and corresponding elements from each vector is passed for each iteration. If the lengths of vectors differ, it stops at the end of the shortest one.

SRFI 133

[procedure] (u8vector-partition pred? @vec) -> @vector integer
[procedure] (s8vector-partition pred? @vec) -> @vector integer
[procedure] (u16vector-partition pred? @vec) -> @vector integer
[procedure] (s16vector-partition pred? @vec) -> @vector integer
[procedure] (u32vector-partition pred? @vec) -> @vector integer
[procedure] (s32vector-partition pred? @vec) -> @vector integer
[procedure] (u64vector-partition pred? @vec) -> @vector integer
[procedure] (s64vector-partition pred? @vec) -> @vector integer
[procedure] (f32vector-partition pred? @vec) -> @vector integer
[procedure] (f64vector-partition pred? @vec) -> @vector integer
[procedure] (c64vector-partition pred? @vec) -> @vector integer
[procedure] (c128vector-partition pred? @vec) -> @vector integer

Returns an @vector of the same type as @vec, but with all elements satisfying pred? in the leftmost part of the vector and the other elements in the remaining part. The order of elements is otherwise preserved. Returns two values, the new @vector and the number of elements satisfying pred?.

SRFI 133

[procedure] (u8vector-filter pred? @vec) -> @vector
[procedure] (s8vector-filter pred? @vec) -> @vector
[procedure] (u16vector-filter pred? @vec) -> @vector
[procedure] (s16vector-filter pred? @vec) -> @vector
[procedure] (u32vector-filter pred? @vec) -> @vector
[procedure] (s32vector-filter pred? @vec) -> @vector
[procedure] (u64vector-filter pred? @vec) -> @vector
[procedure] (s64vector-filter pred? @vec) -> @vector
[procedure] (f32vector-filter pred? @vec) -> @vector
[procedure] (f64vector-filter pred? @vec) -> @vector
[procedure] (c64vector-filter pred? @vec) -> @vector
[procedure] (c128vector-filter pred? @vec) -> @vector

Return an @vector containing the elements of @vec that satisfy pred?.

SRFI 152

[procedure] (u8vector-remove pred? @vec) -> @vector
[procedure] (s8vector-remove pred? @vec) -> @vector
[procedure] (u16vector-remove pred? @vec) -> @vector
[procedure] (s16vector-remove pred? @vec) -> @vector
[procedure] (u32vector-remove pred? @vec) -> @vector
[procedure] (s32vector-remove pred? @vec) -> @vector
[procedure] (u64vector-remove pred? @vec) -> @vector
[procedure] (s64vector-remove pred? @vec) -> @vector
[procedure] (f32vector-remove pred? @vec) -> @vector
[procedure] (f64vector-remove pred? @vec) -> @vector
[procedure] (c64vector-remove pred? @vec) -> @vector
[procedure] (c128vector-remove pred? @vec) -> @vector

Return an @vector containing the elements of @vec that do not satisfy pred?.

SRFI 152

Mutators

[procedure] (u8vector-set! @vec i value) -> unspecified
[procedure] (s8vector-set! @vec i value) -> unspecified
[procedure] (u16vector-set! @vec i value) -> unspecified
[procedure] (s16vector-set! @vec i value) -> unspecified
[procedure] (u32vector-set! @vec i value) -> unspecified
[procedure] (s32vector-set! @vec i value) -> unspecified
[procedure] (u64vector-set! @vec i value) -> unspecified
[procedure] (s64vector-set! @vec i value) -> unspecified
[procedure] (f32vector-set! @vec i value) -> unspecified
[procedure] (f64vector-set! @vec i value) -> unspecified
[procedure] (c64vector-set! @vec i value) -> unspecified
[procedure] (c128vector-set! @vec i value) -> unspecified

Sets the ith element of @vec to value.

SRFI 4

[procedure] (u8vector-swap! @vec i j) -> unspecified
[procedure] (s8vector-swap! @vec i j) -> unspecified
[procedure] (u16vector-swap! @vec i j) -> unspecified
[procedure] (s16vector-swap! @vec i j) -> unspecified
[procedure] (u32vector-swap! @vec i j) -> unspecified
[procedure] (s32vector-swap! @vec i j) -> unspecified
[procedure] (u64vector-swap! @vec i j) -> unspecified
[procedure] (s64vector-swap! @vec i j) -> unspecified
[procedure] (f32vector-swap! @vec i j) -> unspecified
[procedure] (f64vector-swap! @vec i j) -> unspecified
[procedure] (c64vector-swap! @vec i j) -> unspecified
[procedure] (c128vector-swap! @vec i j) -> unspecified

Interchanges the ith and jth elements of @vec.

[procedure] (u8vector-fill! @vec fill [start [end]]) -> unspecified
[procedure] (s8vector-fill! @vec fill [start [end]]) -> unspecified
[procedure] (u16vector-fill! @vec fill [start [end]]) -> unspecified
[procedure] (s16vector-fill! @vec fill [start [end]]) -> unspecified
[procedure] (u32vector-fill! @vec fill [start [end]]) -> unspecified
[procedure] (s32vector-fill! @vec fill [start [end]]) -> unspecified
[procedure] (u64vector-fill! @vec fill [start [end]]) -> unspecified
[procedure] (s64vector-fill! @vec fill [start [end]]) -> unspecified
[procedure] (f32vector-fill! @vec fill [start [end]]) -> unspecified
[procedure] (f64vector-fill! @vec fill [start [end]]) -> unspecified
[procedure] (c64vector-fill! @vec fill [start [end]]) -> unspecified
[procedure] (c128vector-fill! @vec fill [start [end]]) -> unspecified

Fills the portion of @vec from start to end with the value fill.

SRFI 133

[procedure] (u8vector-reverse! @vec [start [end]]) -> unspecified
[procedure] (s8vector-reverse! @vec [start [end]]) -> unspecified
[procedure] (u16vector-reverse! @vec [start [end]]) -> unspecified
[procedure] (s16vector-reverse! @vec [start [end]]) -> unspecified
[procedure] (u32vector-reverse! @vec [start [end]]) -> unspecified
[procedure] (s32vector-reverse! @vec [start [end]]) -> unspecified
[procedure] (u64vector-reverse! @vec [start [end]]) -> unspecified
[procedure] (s64vector-reverse! @vec [start [end]]) -> unspecified
[procedure] (f32vector-reverse! @vec [start [end]]) -> unspecified
[procedure] (f64vector-reverse! @vec [start [end]]) -> unspecified
[procedure] (c64vector-reverse! @vec [start [end]]) -> unspecified
[procedure] (c128vector-reverse! @vec [start [end]]) -> unspecified

Reverses the portion of @vec from start to end.

SRFI 133

[procedure] (u8vector-copy! @to at @from [start [end]]) -> unspecified
[procedure] (s8vector-copy! @to at @from [start [end]]) -> unspecified
[procedure] (u16vector-copy! @to at @from [start [end]]) -> unspecified
[procedure] (s16vector-copy! @to at @from [start [end]]) -> unspecified
[procedure] (u32vector-copy! @to at @from [start [end]]) -> unspecified
[procedure] (s32vector-copy! @to at @from [start [end]]) -> unspecified
[procedure] (u64vector-copy! @to at @from [start [end]]) -> unspecified
[procedure] (s64vector-copy! @to at @from [start [end]]) -> unspecified
[procedure] (f32vector-copy! @to at @from [start [end]]) -> unspecified
[procedure] (f64vector-copy! @to at @from [start [end]]) -> unspecified
[procedure] (c64vector-copy! @to at @from [start [end]]) -> unspecified
[procedure] (c128vector-copy! @to at @from [start [end]]) -> unspecified

Copies the portion of @from from start to end onto @to, starting at index at.

SRFI 133

[procedure] (u8vector-reverse-copy! @to at @from [start [end]]) -> unspecified
[procedure] (s8vector-reverse-copy! @to at @from [start [end]]) -> unspecified
[procedure] (u16vector-reverse-copy! @to at @from [start [end]]) -> unspecified
[procedure] (s16vector-reverse-copy! @to at @from [start [end]]) -> unspecified
[procedure] (u32vector-reverse-copy! @to at @from [start [end]]) -> unspecified
[procedure] (s32vector-reverse-copy! @to at @from [start [end]]) -> unspecified
[procedure] (u64vector-reverse-copy! @to at @from [start [end]]) -> unspecified
[procedure] (s64vector-reverse-copy! @to at @from [start [end]]) -> unspecified
[procedure] (f32vector-reverse-copy! @to at @from [start [end]]) -> unspecified
[procedure] (f64vector-reverse-copy! @to at @from [start [end]]) -> unspecified
[procedure] (c64vector-reverse-copy! @to at @from [start [end]]) -> unspecified
[procedure] (c128vector-reverse-copy! @to at @from [start [end]]) -> unspecified

The same as @vector-copy!, but copies in reverse.

SRFI 133

[procedure] (u8vector-unfold! f @vec start end seed) -> @vector
[procedure] (s8vector-unfold! f @vec start end seed) -> @vector
[procedure] (u16vector-unfold! f @vec start end seed) -> @vector
[procedure] (s16vector-unfold! f @vec start end seed) -> @vector
[procedure] (u32vector-unfold! f @vec start end seed) -> @vector
[procedure] (s32vector-unfold! f @vec start end seed) -> @vector
[procedure] (u64vector-unfold! f @vec start end seed) -> @vector
[procedure] (s64vector-unfold! f @vec start end seed) -> @vector
[procedure] (f32vector-unfold! f @vec start end seed) -> @vector
[procedure] (f64vector-unfold! f @vec start end seed) -> @vector
[procedure] (c64vector-unfold! f @vec start end seed) -> @vector
[procedure] (c128vector-unfold! f @vec start end seed) -> @vector

Like vector-unfold, but the elements are copied into the vector @vec starting at element start rather than into a newly allocated vector. Terminates when end - start elements have been generated.

SRFI 133

[procedure] (u8vector-unfold-right! f @vec start end seed) -> @vector
[procedure] (s8vector-unfold-right! f @vec start end seed) -> @vector
[procedure] (u16vector-unfold-right! f @vec start end seed) -> @vector
[procedure] (s16vector-unfold-right! f @vec start end seed) -> @vector
[procedure] (u32vector-unfold-right! f @vec start end seed) -> @vector
[procedure] (s32vector-unfold-right! f @vec start end seed) -> @vector
[procedure] (u64vector-unfold-right! f @vec start end seed) -> @vector
[procedure] (s64vector-unfold-right! f @vec start end seed) -> @vector
[procedure] (f32vector-unfold-right! f @vec start end seed) -> @vector
[procedure] (f64vector-unfold-right! f @vec start end seed) -> @vector
[procedure] (c64vector-unfold-right! f @vec start end seed) -> @vector
[procedure] (c128vector-unfold-right! f @vec start end seed) -> @vector

The same as @vector-unfold!, but initializes the @vector from right to left.

SRFI 133

Conversion

[procedure] (u8vector->list @vec [start [end]]) -> proper-list
[procedure] (s8vector->list @vec [start [end]]) -> proper-list
[procedure] (u16vector->list @vec [start [end]]) -> proper-list
[procedure] (s16vector->list @vec [start [end]]) -> proper-list
[procedure] (u32vector->list @vec [start [end]]) -> proper-list
[procedure] (s32vector->list @vec [start [end]]) -> proper-list
[procedure] (u64vector->list @vec [start [end]]) -> proper-list
[procedure] (s64vector->list @vec [start [end]]) -> proper-list
[procedure] (f32vector->list @vec [start [end]]) -> proper-list
[procedure] (f64vector->list @vec [start [end]]) -> proper-list
[procedure] (c64vector->list @vec [start [end]]) -> proper-list
[procedure] (c128vector->list @vec [start [end]]) -> proper-list

Returns a list, with the same elements as the argument.

SRFI 4

[procedure] (reverse-u8vector->list @vec [start [end]]) -> proper-list
[procedure] (reverse-s8vector->list @vec [start [end]]) -> proper-list
[procedure] (reverse-u16vector->list @vec [start [end]]) -> proper-list
[procedure] (reverse-s16vector->list @vec [start [end]]) -> proper-list
[procedure] (reverse-u32vector->list @vec [start [end]]) -> proper-list
[procedure] (reverse-s32vector->list @vec [start [end]]) -> proper-list
[procedure] (reverse-u64vector->list @vec [start [end]]) -> proper-list
[procedure] (reverse-s64vector->list @vec [start [end]]) -> proper-list
[procedure] (reverse-f32vector->list @vec [start [end]]) -> proper-list
[procedure] (reverse-f64vector->list @vec [start [end]]) -> proper-list
[procedure] (reverse-c64vector->list @vec [start [end]]) -> proper-list
[procedure] (reverse-c128vector->list @vec [start [end]]) -> proper-list

Returns a list, with the same elements as the argument in reverse order.

SRFI 133

[procedure] (list->u8vector proper-list) -> @vector
[procedure] (list->s8vector proper-list) -> @vector
[procedure] (list->u16vector proper-list) -> @vector
[procedure] (list->s16vector proper-list) -> @vector
[procedure] (list->u32vector proper-list) -> @vector
[procedure] (list->s32vector proper-list) -> @vector
[procedure] (list->u64vector proper-list) -> @vector
[procedure] (list->s64vector proper-list) -> @vector
[procedure] (list->f32vector proper-list) -> @vector
[procedure] (list->f64vector proper-list) -> @vector
[procedure] (list->c64vector proper-list) -> @vector
[procedure] (list->c128vector proper-list) -> @vector

Returns an @vector with the same elements as the argument.

SRFI 4

[procedure] (reverse-list->u8vector proper-list) -> @vector
[procedure] (reverse-list->s8vector proper-list) -> @vector
[procedure] (reverse-list->u16vector proper-list) -> @vector
[procedure] (reverse-list->s16vector proper-list) -> @vector
[procedure] (reverse-list->u32vector proper-list) -> @vector
[procedure] (reverse-list->s32vector proper-list) -> @vector
[procedure] (reverse-list->u64vector proper-list) -> @vector
[procedure] (reverse-list->s64vector proper-list) -> @vector
[procedure] (reverse-list->f32vector proper-list) -> @vector
[procedure] (reverse-list->f64vector proper-list) -> @vector
[procedure] (reverse-list->c64vector proper-list) -> @vector
[procedure] (reverse-list->c128vector proper-list) -> @vector

Returns an @vector with the same elements as the argument in reverse order.

SRFI 133

[procedure] (u8vector->vector @vec [start [end]]) -> vector
[procedure] (s8vector->vector @vec [start [end]]) -> vector
[procedure] (u16vector->vector @vec [start [end]]) -> vector
[procedure] (s16vector->vector @vec [start [end]]) -> vector
[procedure] (u32vector->vector @vec [start [end]]) -> vector
[procedure] (s32vector->vector @vec [start [end]]) -> vector
[procedure] (u64vector->vector @vec [start [end]]) -> vector
[procedure] (s64vector->vector @vec [start [end]]) -> vector
[procedure] (f32vector->vector @vec [start [end]]) -> vector
[procedure] (f64vector->vector @vec [start [end]]) -> vector
[procedure] (c64vector->vector @vec [start [end]]) -> vector
[procedure] (c128vector->vector @vec [start [end]]) -> vector

Returns a heterogeneous vector with the same elements as the argument.

[procedure] (vector->u8vector vec [start [end]]) -> @vector
[procedure] (vector->s8vector vec [start [end]]) -> @vector
[procedure] (vector->u16vector vec [start [end]]) -> @vector
[procedure] (vector->s16vector vec [start [end]]) -> @vector
[procedure] (vector->u32vector vec [start [end]]) -> @vector
[procedure] (vector->s32vector vec [start [end]]) -> @vector
[procedure] (vector->u64vector vec [start [end]]) -> @vector
[procedure] (vector->s64vector vec [start [end]]) -> @vector
[procedure] (vector->f32vector vec [start [end]]) -> @vector
[procedure] (vector->f64vector vec [start [end]]) -> @vector
[procedure] (vector->c64vector vec [start [end]]) -> @vector
[procedure] (vector->c128vector vec [start [end]]) -> @vector

Returns an @vector with the same elements as the argument.

Generators

[procedure] (make-u8vector-generator @vector)
[procedure] (make-s8vector-generator @vector)
[procedure] (make-u16vector-generator @vector)
[procedure] (make-s16vector-generator @vector)
[procedure] (make-u32vector-generator @vector)
[procedure] (make-s32vector-generator @vector)
[procedure] (make-u64vector-generator @vector)
[procedure] (make-s64vector-generator @vector)
[procedure] (make-f32vector-generator @vector)
[procedure] (make-f64vector-generator @vector)
[procedure] (make-c64vector-generator @vector)
[procedure] (make-c128vector-generator @vector)

Returns a SRFI 121 generator that generates all the values of @vector in order. Note that the generator is finite.

Comparators

[constant] u8vector-comparator
[constant] s8vector-comparator
[constant] u16vector-comparator
[constant] s16vector-comparator
[constant] u32vector-comparator
[constant] s32vector-comparator
[constant] u64vector-comparator
[constant] s64vector-comparator
[constant] f32vector-comparator
[constant] f64vector-comparator
[constant] c64vector-comparator
[constant] c128vector-comparator

Variable containing a SRFI 128 comparator whose components provide ordering and hashing of @vectors.

Output

[procedure] (write-u8vector @vec [ port ] ) -> unspecified
[procedure] (write-s8vector @vec [ port ] ) -> unspecified
[procedure] (write-u16vector @vec [ port ] ) -> unspecified
[procedure] (write-s16vector @vec [ port ] ) -> unspecified
[procedure] (write-u32vector @vec [ port ] ) -> unspecified
[procedure] (write-s32vector @vec [ port ] ) -> unspecified
[procedure] (write-u64vector @vec [ port ] ) -> unspecified
[procedure] (write-s64vector @vec [ port ] ) -> unspecified
[procedure] (write-f32vector @vec [ port ] ) -> unspecified
[procedure] (write-f64vector @vec [ port ] ) -> unspecified
[procedure] (write-c64vector @vec [ port ] ) -> unspecified
[procedure] (write-c128vector @vec [ port ] ) -> unspecified

Prints to port (the current output port by default) a representation of @vec in the lexical syntax explained below.

The SRFI 160 base library

The library (srfi 160 base) is in the repository of this SRFI. It supports the eight procedures of SRFI 4, namely make-@vector, @vector, @vector?, @vector-length, @vector-ref, @vector-set!, @vector->list, and list->@vector, not only for the ten homogeneous vector types supported by SRFI 4, but also for the two homogeneous vector types beyond the scope of SRFI 4, namely c64vectors and c128vectors. In addition, the @? procedure, which is not in SRFI 4, is available for all types.

Acknowledgements

Thanks to all participants in the SRFI 160 mailing list over the unconscionably long time it took me to get this proposal to finalization. Special thanks to Shiro Kawai for bringing up many issues and contributing the code that extended many procedures from one @vector to many.

Authors

Maintainer

Diego A. Mundo

Repository

https://git.sr.ht/~dieggsy/srfi-160/

Copyright © John Cowan 2018.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice (including the next
paragraph) shall be included in all copies or substantial portions of the
Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

Version history

0.5.3
Revert breaking build changes in 0.5.2
0.5.2
Build enhancements
0.5.1
Add a record printer/reader, handle non-fixnum length passed to make-c*vector
0.5
Optimize performance using fixnum operations and move-memory!, export c*vector-body
0.4
Fix bugs in @vector-fold-right and @vector-reverse!
0.3
Ensure correct result for @vector= with more than 2 vectors
0.2
Ensure start and end arguments to copy! procedures are optional
0.1
Ported to Chicken Scheme 5