chickadee » srfi-160

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):

c64vectortype

inexact complex, typically 64 bits

c128vectortype

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

A Scheme system that conforms to this SRFI does not have to support all of these homogeneous vector datatypes. However, a Scheme system must support float vectors if it supports Scheme inexact reals (of any precision). A Scheme system must support complex vectors if it supports Scheme inexact complex numbers (of any precision). Finally, a Scheme system must support a particular integer vector datatype if the system's exact integer datatype contains all the values that can be stored in such an integer vector. Thus a Scheme system with bignum support must implement all the integer vector datatypes, but a Scheme system might only support s8vectors, u8vectors, s16vectors and u16vectors if it only supports integers in the range -2^29 to 2^29-1 (which would be the case if they are represented as 32-bit machine integers with a 2-bit tag).

Scheme systems which conform to this SRFI and also conform to either R6RS or R7RS should use the same datatype for bytevectors and for u8vectors, and systems that also implement SRFI 74 (blobs) should use the same datatype for them as well. All other homogeneous vector types are disjoint from each other and from all other Scheme types,

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.

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:

(f arg[1] arg[2] ...) -> somethingprocedure

A procedure f that takes the parameters arg[1] arg[2] ... and returns a value of the type something. If two values are returned, two types are specified. If something is unspecified, then f returns a single implementation-dependent value; this SRFI does not specify what it returns, and in order to write portable code, the return value should be ignored.

vecparameter

Must be a heterogeneous vector, i.e. it must satisfy the predicate vector?.

@vecparameter
@toparameter
@fromparameter

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.

iparameter
jparameter
startparameter
atparameter

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.

endparameter

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.

fparameter

Must be a procedure taking one or more arguments, which returns (except as noted otherwise) exactly one value.

predparameter

Must be a procedure taking one or more arguments that returns one value, which is treated as a boolean.

=parameter

Must be an equivalence procedure.

objparameter
seedparameter
knilparameter

Any Scheme object.

fillparameter
valueparameter

Any number that is valid with respect to the @vec.

somethingparameter

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.

somethingparameter

Zero or more somethings are allowed to be arguments.

somethingparameter

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

Module (srfi 160 base)

Defines make-@vector, @vector, @vector?, @vector-length, @vector-ref, @vector-set!, @vector->list, list->@vector, and @?, for all types. All of these are also re-exported by the respective (srfi 160 @) modules and described below.

Module (srfi 160 u8)

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] unless they are already marked with [SRFI 4]. The procedures analogous to SRFI 152 string procedures are marked with [SRFI 152].

Constructors

make-u8vector size #!optional fillprocedure

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

u8vector value ...procedure

Returns a u8vector initialized with values.

u8vector-unfold f length seedprocedure

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.

u8vector-unfold-right f length seedprocedure

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

u8vector-copy u8vec #!optional start endprocedure

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

u8vector-reverse-copy u8vec #!optional start endprocedure

The same as u8vector-copy, but in reverse order.

u8vector-append u8vec ...procedure

Returns a u8vector containing all the elements of the u8vecs in order.

u8vector-concatenate list-of-u8vectorsprocedure

The same as u8vector-append, but takes a list of u8vectors rather than multiple arguments.

(u8vector-append-subvectors [u8vec start end] ...) -> u8vector [SRFI 133]procedure

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

Predicates

u8? objprocedure

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

u8vector? objprocedure

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

u8vector-empty? u8vecprocedure

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

u8vector= u8vec ...procedure

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

Selectors

u8vector-ref u8vec iprocedure

Returns the ith element of u8vec.

u8vector-length u8vecprocedure

Returns the length of u8vec

Iteration

u8vector-take u8vec nprocedure
u8vector-take-right u8vec nprocedure

Returns a u8vector containing the first/last n elements of u8vec.

u8vector-drop u8vec nprocedure
u8vector-drop-right u8vec nprocedure

Returns a u8vector containing all except the first/last n elements of u8vec.

u8vector-segment u8vec nprocedure

Returns a list of u8vectors, each of which contains n consecutive elements of u8vec. The last u8vector may be shorter than n.

u8vector-fold kons knil u8vec u8vec2 ...procedure
u8vector-fold-right kons knil u8vec u8vec2 ...procedure

When one u8vector argument u8vec is given, folds kons over the elements of u8vec in increasing/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 u8vector arguments are given, kons is called with the current state value and each value from all the vectors; u8vector-fold scans elements from left to right, while u8vector-fold-right does 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.

u8vector-map f u8vec u8vec2 ...procedure
u8vector-map! f u8vec u8vec2 ...procedure
u8vector-for-each f u8vec u8vec2 ...procedure

Iterate over the elements of u8vec and apply f to each, returning respectively a u8vector of the results, an undefined value with the results placed back in u8vec, and an undefined value with no change to u8vec.

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. For u8vector-map!, only u8vec is modified even when multiple vectors are passed.

If u8vector-map or u8vector-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.

u8vector-count pred? u8vec u8vec2 ...procedure

Call pred? on each element of u8vec 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.

u8vector-cumulate f knil u8vecprocedure

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

Searching

u8vector-take-while pred? u8vecprocedure
u8vector-take-while-right pred? u8vecprocedure

Return the shortest prefix/suffix of u8vec all of whose elements satisfy pred?.

u8vector-drop-while pred? u8vecprocedure
u8vector-drop-while-right pred? u8vecprocedure

Drops the longest initial prefix/suffix of u8vec such that all its elements satisfy pred.

u8vector-index pred? u8vec u8vec2 ...procedure
u8vector-index-right pred? u8vec u8vec2 ...procedure

Return the index of the first/last element of u8vec 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, u8vector-index stops iteration at the end of the shortest one. Lengths of vectors must be the same for u8vector-index-right.

u8vector-skip pred? u8vec u8vec2 ...procedure
u8vector-skip-right pred? u8vec u8vec2 ...procedure

Returns the index of the first/last element of u8vec 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, u8vector-skip stops iteration at the end of the shortest one. Lengths of vectors must be the same for u8vector-skip-right.

u8vector-any pred? u8vec u8vec2 ...procedure

Returns first non-false result of applying pred? on a element from the u8vec, or #f if there is no such element. If u8vec 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.

u8vector-every pred? u8vec u8vec2 ...procedure

If all elements from u8vec satisfy pred?, return the last result of pred?. If not all do, return #f. If u8vec 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.

u8vector-partition pred? u8vecprocedure

Returns an u8vector of the same type as u8vec, 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 u8vector and the number of elements satisfying pred?.

u8vector-filter pred? u8vecprocedure
u8vector-remove pred? u8vecprocedure

Return an u8vector containing the elements of u8vec that satisfy / do not satisfy pred?.

Mutators

u8vector-set! u8vec i valueprocedure

Sets the ith element of u8vec to value.

u8vector-swap! u8vec i jprocedure

Interchanges the ith and jth elements of u8vec.

u8vector-fill! u8vec fill #!optional start endprocedure

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

u8vector-reverse! u8vec #!optional start endprocedure

Reverses the portion of u8vec from start to end.

u8vector-copy! u8to at u8from #!optional start endprocedure

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

u8vector-reverse-copy! u8to at u8from #!optional start endprocedure

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

u8vector-unfold! f u8vec start end seedprocedure

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

u8vector-unfold-right! f u8vec start end seedprocedure

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

Conversion

u8vector->list u8vec #!optional start endprocedure
reverse-u8vector->list u8vec #!optional start endprocedure
list->u8vector proper-listprocedure
reverse-list->u8vector proper-listprocedure
u8vector->vector u8vec #!optional start endprocedure
vector->u8vector vec #!optional start endprocedure

Returns a list, u8vector, or heterogeneous vector with the same elements as the argument, in reverse order where specified.

Generators

make-u8vector-generator u8vectorprocedure

Returns a [[https://srfi.schemers.org/srfi-121/srfi-121.html][SRFI 121]] generator that generates all the values of u8vector in order. Note that the generator is finite.

Comparators

u8vector-comparator

Variable containing a [[https://srfi.schemers.org/srfi-128/srfi-128.html][SRFI 128]] comparator whose components provide ordering and hashing of u8vectors.

Output

write-u8vector u8vec #!optional portprocedure

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

Module (srfi 160 s8)

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] unless they are already marked with [SRFI 4]. The procedures analogous to SRFI 152 string procedures are marked with [SRFI 152].

Constructors

make-s8vector size #!optional fillprocedure

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

s8vector value ...procedure

Returns a s8vector initialized with values.

s8vector-unfold f length seedprocedure

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.

s8vector-unfold-right f length seedprocedure

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

s8vector-copy s8vec #!optional start endprocedure

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

s8vector-reverse-copy s8vec #!optional start endprocedure

The same as s8vector-copy, but in reverse order.

s8vector-append s8vec ...procedure

Returns a s8vector containing all the elements of the s8vecs in order.

s8vector-concatenate list-of-s8vectorsprocedure

The same as s8vector-append, but takes a list of s8vectors rather than multiple arguments.

(s8vector-append-subvectors [s8vec start end] ...) -> s8vector [SRFI 133]procedure

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

Predicates

s8? objprocedure

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

s8vector? objprocedure

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

s8vector-empty? s8vecprocedure

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

s8vector= s8vec ...procedure

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

Selectors

s8vector-ref s8vec iprocedure

Returns the ith element of s8vec.

s8vector-length s8vecprocedure

Returns the length of s8vec

Iteration

s8vector-take s8vec nprocedure
s8vector-take-right s8vec nprocedure

Returns a s8vector containing the first/last n elements of s8vec.

s8vector-drop s8vec nprocedure
s8vector-drop-right s8vec nprocedure

Returns a s8vector containing all except the first/last n elements of s8vec.

s8vector-segment s8vec nprocedure

Returns a list of s8vectors, each of which contains n consecutive elements of s8vec. The last s8vector may be shorter than n.

s8vector-fold kons knil s8vec s8vec2 ...procedure
s8vector-fold-right kons knil s8vec s8vec2 ...procedure

When one s8vector argument s8vec is given, folds kons over the elements of s8vec in increasing/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 s8vector arguments are given, kons is called with the current state value and each value from all the vectors; s8vector-fold scans elements from left to right, while s8vector-fold-right does 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.

s8vector-map f s8vec s8vec2 ...procedure
s8vector-map! f s8vec s8vec2 ...procedure
s8vector-for-each f s8vec s8vec2 ...procedure

Iterate over the elements of s8vec and apply f to each, returning respectively a s8vector of the results, an undefined value with the results placed back in s8vec, and an undefined value with no change to s8vec.

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. For s8vector-map!, only s8vec is modified even when multiple vectors are passed.

If s8vector-map or s8vector-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.

s8vector-count pred? s8vec s8vec2 ...procedure

Call pred? on each element of s8vec 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.

s8vector-cumulate f knil s8vecprocedure

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

Searching

s8vector-take-while pred? s8vecprocedure
s8vector-take-while-right pred? s8vecprocedure

Return the shortest prefix/suffix of s8vec all of whose elements satisfy pred?.

s8vector-drop-while pred? s8vecprocedure
s8vector-drop-while-right pred? s8vecprocedure

Drops the longest initial prefix/suffix of s8vec such that all its elements satisfy pred.

s8vector-index pred? s8vec s8vec2 ...procedure
s8vector-index-right pred? s8vec s8vec2 ...procedure

Return the index of the first/last element of s8vec 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, s8vector-index stops iteration at the end of the shortest one. Lengths of vectors must be the same for s8vector-index-right.

s8vector-skip pred? s8vec s8vec2 ...procedure
s8vector-skip-right pred? s8vec s8vec2 ...procedure

Returns the index of the first/last element of s8vec 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, s8vector-skip stops iteration at the end of the shortest one. Lengths of vectors must be the same for s8vector-skip-right.

s8vector-any pred? s8vec s8vec2 ...procedure

Returns first non-false result of applying pred? on a element from the s8vec, or #f if there is no such element. If s8vec 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.

s8vector-every pred? s8vec s8vec2 ...procedure

If all elements from s8vec satisfy pred?, return the last result of pred?. If not all do, return #f. If s8vec 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.

s8vector-partition pred? s8vecprocedure

Returns an s8vector of the same type as s8vec, 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 s8vector and the number of elements satisfying pred?.

s8vector-filter pred? s8vecprocedure
s8vector-remove pred? s8vecprocedure

Return an s8vector containing the elements of s8vec that satisfy / do not satisfy pred?.

Mutators

s8vector-set! s8vec i valueprocedure

Sets the ith element of s8vec to value.

s8vector-swap! s8vec i jprocedure

Interchanges the ith and jth elements of s8vec.

s8vector-fill! s8vec fill #!optional start endprocedure

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

s8vector-reverse! s8vec #!optional start endprocedure

Reverses the portion of s8vec from start to end.

s8vector-copy! s8to at s8from #!optional start endprocedure

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

s8vector-reverse-copy! s8to at s8from #!optional start endprocedure

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

s8vector-unfold! f s8vec start end seedprocedure

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

s8vector-unfold-right! f s8vec start end seedprocedure

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

Conversion

s8vector->list s8vec #!optional start endprocedure
reverse-s8vector->list s8vec #!optional start endprocedure
list->s8vector proper-listprocedure
reverse-list->s8vector proper-listprocedure
s8vector->vector s8vec #!optional start endprocedure
vector->s8vector vec #!optional start endprocedure

Returns a list, s8vector, or heterogeneous vector with the same elements as the argument, in reverse order where specified.

Generators

make-s8vector-generator s8vectorprocedure

Returns a [[https://srfi.schemers.org/srfi-121/srfi-121.html][SRFI 121]] generator that generates all the values of s8vector in order. Note that the generator is finite.

Comparators

s8vector-comparator

Variable containing a [[https://srfi.schemers.org/srfi-128/srfi-128.html][SRFI 128]] comparator whose components provide ordering and hashing of s8vectors.

Output

write-s8vector s8vec #!optional portprocedure

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

Module (srfi 160 u16)

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] unless they are already marked with [SRFI 4]. The procedures analogous to SRFI 152 string procedures are marked with [SRFI 152].

Constructors

make-u16vector size #!optional fillprocedure

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

u16vector value ...procedure

Returns a u16vector initialized with values.

u16vector-unfold f length seedprocedure

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.

u16vector-unfold-right f length seedprocedure

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

u16vector-copy u16vec #!optional start endprocedure

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

u16vector-reverse-copy u16vec #!optional start endprocedure

The same as u16vector-copy, but in reverse order.

u16vector-append u16vec ...procedure

Returns a u16vector containing all the elements of the u16vecs in order.

u16vector-concatenate list-of-u16vectorsprocedure

The same as u16vector-append, but takes a list of u16vectors rather than multiple arguments.

(u16vector-append-subvectors [u16vec start end] ...) -> u16vector [SRFI 133]procedure

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

Predicates

u16? objprocedure

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

u16vector? objprocedure

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

u16vector-empty? u16vecprocedure

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

u16vector= u16vec ...procedure

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

Selectors

u16vector-ref u16vec iprocedure

Returns the ith element of u16vec.

u16vector-length u16vecprocedure

Returns the length of u16vec

Iteration

u16vector-take u16vec nprocedure
u16vector-take-right u16vec nprocedure

Returns a u16vector containing the first/last n elements of u16vec.

u16vector-drop u16vec nprocedure
u16vector-drop-right u16vec nprocedure

Returns a u16vector containing all except the first/last n elements of u16vec.

u16vector-segment u16vec nprocedure

Returns a list of u16vectors, each of which contains n consecutive elements of u16vec. The last u16vector may be shorter than n.

u16vector-fold kons knil u16vec u16vec2 ...procedure
u16vector-fold-right kons knil u16vec u16vec2 ...procedure

When one u16vector argument u16vec is given, folds kons over the elements of u16vec in increasing/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 u16vector arguments are given, kons is called with the current state value and each value from all the vectors; u16vector-fold scans elements from left to right, while u16vector-fold-right does 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.

u16vector-map f u16vec u16vec2 ...procedure
u16vector-map! f u16vec u16vec2 ...procedure
u16vector-for-each f u16vec u16vec2 ...procedure

Iterate over the elements of u16vec and apply f to each, returning respectively a u16vector of the results, an undefined value with the results placed back in u16vec, and an undefined value with no change to u16vec.

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. For u16vector-map!, only u16vec is modified even when multiple vectors are passed.

If u16vector-map or u16vector-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.

u16vector-count pred? u16vec u16vec2 ...procedure

Call pred? on each element of u16vec 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.

u16vector-cumulate f knil u16vecprocedure

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

Searching

u16vector-take-while pred? u16vecprocedure
u16vector-take-while-right pred? u16vecprocedure

Return the shortest prefix/suffix of u16vec all of whose elements satisfy pred?.

u16vector-drop-while pred? u16vecprocedure
u16vector-drop-while-right pred? u16vecprocedure

Drops the longest initial prefix/suffix of u16vec such that all its elements satisfy pred.

u16vector-index pred? u16vec u16vec2 ...procedure
u16vector-index-right pred? u16vec u16vec2 ...procedure

Return the index of the first/last element of u16vec 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, u16vector-index stops iteration at the end of the shortest one. Lengths of vectors must be the same for u16vector-index-right.

u16vector-skip pred? u16vec u16vec2 ...procedure
u16vector-skip-right pred? u16vec u16vec2 ...procedure

Returns the index of the first/last element of u16vec 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, u16vector-skip stops iteration at the end of the shortest one. Lengths of vectors must be the same for u16vector-skip-right.

u16vector-any pred? u16vec u16vec2 ...procedure

Returns first non-false result of applying pred? on a element from the u16vec, or #f if there is no such element. If u16vec 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.

u16vector-every pred? u16vec u16vec2 ...procedure

If all elements from u16vec satisfy pred?, return the last result of pred?. If not all do, return #f. If u16vec 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.

u16vector-partition pred? u16vecprocedure

Returns an u16vector of the same type as u16vec, 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 u16vector and the number of elements satisfying pred?.

u16vector-filter pred? u16vecprocedure
u16vector-remove pred? u16vecprocedure

Return an u16vector containing the elements of u16vec that satisfy / do not satisfy pred?.

Mutators

u16vector-set! u16vec i valueprocedure

Sets the ith element of u16vec to value.

u16vector-swap! u16vec i jprocedure

Interchanges the ith and jth elements of u16vec.

u16vector-fill! u16vec fill #!optional start endprocedure

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

u16vector-reverse! u16vec #!optional start endprocedure

Reverses the portion of u16vec from start to end.

u16vector-copy! u16to at u16from #!optional start endprocedure

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

u16vector-reverse-copy! u16to at u16from #!optional start endprocedure

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

u16vector-unfold! f u16vec start end seedprocedure

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

u16vector-unfold-right! f u16vec start end seedprocedure

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

Conversion

u16vector->list u16vec #!optional start endprocedure
reverse-u16vector->list u16vec #!optional start endprocedure
list->u16vector proper-listprocedure
reverse-list->u16vector proper-listprocedure
u16vector->vector u16vec #!optional start endprocedure
vector->u16vector vec #!optional start endprocedure

Returns a list, u16vector, or heterogeneous vector with the same elements as the argument, in reverse order where specified.

Generators

make-u16vector-generator u16vectorprocedure

Returns a [[https://srfi.schemers.org/srfi-121/srfi-121.html][SRFI 121]] generator that generates all the values of u16vector in order. Note that the generator is finite.

Comparators

u16vector-comparator

Variable containing a [[https://srfi.schemers.org/srfi-128/srfi-128.html][SRFI 128]] comparator whose components provide ordering and hashing of u16vectors.

Output

write-u16vector u16vec #!optional portprocedure

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

Module (srfi 160 s16)

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] unless they are already marked with [SRFI 4]. The procedures analogous to SRFI 152 string procedures are marked with [SRFI 152].

Constructors

make-s16vector size #!optional fillprocedure

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

s16vector value ...procedure

Returns a s16vector initialized with values.

s16vector-unfold f length seedprocedure

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.

s16vector-unfold-right f length seedprocedure

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

s16vector-copy s16vec #!optional start endprocedure

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

s16vector-reverse-copy s16vec #!optional start endprocedure

The same as s16vector-copy, but in reverse order.

s16vector-append s16vec ...procedure

Returns a s16vector containing all the elements of the s16vecs in order.

s16vector-concatenate list-of-s16vectorsprocedure

The same as s16vector-append, but takes a list of s16vectors rather than multiple arguments.

(s16vector-append-subvectors [s16vec start end] ...) -> s16vector [SRFI 133]procedure

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

Predicates

s16? objprocedure

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

s16vector? objprocedure

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

s16vector-empty? s16vecprocedure

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

s16vector= s16vec ...procedure

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

Selectors

s16vector-ref s16vec iprocedure

Returns the ith element of s16vec.

s16vector-length s16vecprocedure

Returns the length of s16vec

Iteration

s16vector-take s16vec nprocedure
s16vector-take-right s16vec nprocedure

Returns a s16vector containing the first/last n elements of s16vec.

s16vector-drop s16vec nprocedure
s16vector-drop-right s16vec nprocedure

Returns a s16vector containing all except the first/last n elements of s16vec.

s16vector-segment s16vec nprocedure

Returns a list of s16vectors, each of which contains n consecutive elements of s16vec. The last s16vector may be shorter than n.

s16vector-fold kons knil s16vec s16vec2 ...procedure
s16vector-fold-right kons knil s16vec s16vec2 ...procedure

When one s16vector argument s16vec is given, folds kons over the elements of s16vec in increasing/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 s16vector arguments are given, kons is called with the current state value and each value from all the vectors; s16vector-fold scans elements from left to right, while s16vector-fold-right does 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.

s16vector-map f s16vec s16vec2 ...procedure
s16vector-map! f s16vec s16vec2 ...procedure
s16vector-for-each f s16vec s16vec2 ...procedure

Iterate over the elements of s16vec and apply f to each, returning respectively a s16vector of the results, an undefined value with the results placed back in s16vec, and an undefined value with no change to s16vec.

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. For s16vector-map!, only s16vec is modified even when multiple vectors are passed.

If s16vector-map or s16vector-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.

s16vector-count pred? s16vec s16vec2 ...procedure

Call pred? on each element of s16vec 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.

s16vector-cumulate f knil s16vecprocedure

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

Searching

s16vector-take-while pred? s16vecprocedure
s16vector-take-while-right pred? s16vecprocedure

Return the shortest prefix/suffix of s16vec all of whose elements satisfy pred?.

s16vector-drop-while pred? s16vecprocedure
s16vector-drop-while-right pred? s16vecprocedure

Drops the longest initial prefix/suffix of s16vec such that all its elements satisfy pred.

s16vector-index pred? s16vec s16vec2 ...procedure
s16vector-index-right pred? s16vec s16vec2 ...procedure

Return the index of the first/last element of s16vec 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, s16vector-index stops iteration at the end of the shortest one. Lengths of vectors must be the same for s16vector-index-right.

s16vector-skip pred? s16vec s16vec2 ...procedure
s16vector-skip-right pred? s16vec s16vec2 ...procedure

Returns the index of the first/last element of s16vec 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, s16vector-skip stops iteration at the end of the shortest one. Lengths of vectors must be the same for s16vector-skip-right.

s16vector-any pred? s16vec s16vec2 ...procedure

Returns first non-false result of applying pred? on a element from the s16vec, or #f if there is no such element. If s16vec 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.

s16vector-every pred? s16vec s16vec2 ...procedure

If all elements from s16vec satisfy pred?, return the last result of pred?. If not all do, return #f. If s16vec 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.

s16vector-partition pred? s16vecprocedure

Returns an s16vector of the same type as s16vec, 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 s16vector and the number of elements satisfying pred?.

s16vector-filter pred? s16vecprocedure
s16vector-remove pred? s16vecprocedure

Return an s16vector containing the elements of s16vec that satisfy / do not satisfy pred?.

Mutators

s16vector-set! s16vec i valueprocedure

Sets the ith element of s16vec to value.

s16vector-swap! s16vec i jprocedure

Interchanges the ith and jth elements of s16vec.

s16vector-fill! s16vec fill #!optional start endprocedure

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

s16vector-reverse! s16vec #!optional start endprocedure

Reverses the portion of s16vec from start to end.

s16vector-copy! s16to at s16from #!optional start endprocedure

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

s16vector-reverse-copy! s16to at s16from #!optional start endprocedure

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

s16vector-unfold! f s16vec start end seedprocedure

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

s16vector-unfold-right! f s16vec start end seedprocedure

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

Conversion

s16vector->list s16vec #!optional start endprocedure
reverse-s16vector->list s16vec #!optional start endprocedure
list->s16vector proper-listprocedure
reverse-list->s16vector proper-listprocedure
s16vector->vector s16vec #!optional start endprocedure
vector->s16vector vec #!optional start endprocedure

Returns a list, s16vector, or heterogeneous vector with the same elements as the argument, in reverse order where specified.

Generators

make-s16vector-generator s16vectorprocedure

Returns a [[https://srfi.schemers.org/srfi-121/srfi-121.html][SRFI 121]] generator that generates all the values of s16vector in order. Note that the generator is finite.

Comparators

s16vector-comparator

Variable containing a [[https://srfi.schemers.org/srfi-128/srfi-128.html][SRFI 128]] comparator whose components provide ordering and hashing of s16vectors.

Output

write-s16vector s16vec #!optional portprocedure

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

Module (srfi 160 u32)

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] unless they are already marked with [SRFI 4]. The procedures analogous to SRFI 152 string procedures are marked with [SRFI 152].

Constructors

make-u32vector size #!optional fillprocedure

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

u32vector value ...procedure

Returns a u32vector initialized with values.

u32vector-unfold f length seedprocedure

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.

u32vector-unfold-right f length seedprocedure

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

u32vector-copy u32vec #!optional start endprocedure

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

u32vector-reverse-copy u32vec #!optional start endprocedure

The same as u32vector-copy, but in reverse order.

u32vector-append u32vec ...procedure

Returns a u32vector containing all the elements of the u32vecs in order.

u32vector-concatenate list-of-u32vectorsprocedure

The same as u32vector-append, but takes a list of u32vectors rather than multiple arguments.

(u32vector-append-subvectors [u32vec start end] ...) -> u32vector [SRFI 133]procedure

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

Predicates

u32? objprocedure

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

u32vector? objprocedure

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

u32vector-empty? u32vecprocedure

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

u32vector= u32vec ...procedure

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

Selectors

u32vector-ref u32vec iprocedure

Returns the ith element of u32vec.

u32vector-length u32vecprocedure

Returns the length of u32vec

Iteration

u32vector-take u32vec nprocedure
u32vector-take-right u32vec nprocedure

Returns a u32vector containing the first/last n elements of u32vec.

u32vector-drop u32vec nprocedure
u32vector-drop-right u32vec nprocedure

Returns a u32vector containing all except the first/last n elements of u32vec.

u32vector-segment u32vec nprocedure

Returns a list of u32vectors, each of which contains n consecutive elements of u32vec. The last u32vector may be shorter than n.

u32vector-fold kons knil u32vec u32vec2 ...procedure
u32vector-fold-right kons knil u32vec u32vec2 ...procedure

When one u32vector argument u32vec is given, folds kons over the elements of u32vec in increasing/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 u32vector arguments are given, kons is called with the current state value and each value from all the vectors; u32vector-fold scans elements from left to right, while u32vector-fold-right does 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.

u32vector-map f u32vec u32vec2 ...procedure
u32vector-map! f u32vec u32vec2 ...procedure
u32vector-for-each f u32vec u32vec2 ...procedure

Iterate over the elements of u32vec and apply f to each, returning respectively a u32vector of the results, an undefined value with the results placed back in u32vec, and an undefined value with no change to u32vec.

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. For u32vector-map!, only u32vec is modified even when multiple vectors are passed.

If u32vector-map or u32vector-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.

u32vector-count pred? u32vec u32vec2 ...procedure

Call pred? on each element of u32vec 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.

u32vector-cumulate f knil u32vecprocedure

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

Searching

u32vector-take-while pred? u32vecprocedure
u32vector-take-while-right pred? u32vecprocedure

Return the shortest prefix/suffix of u32vec all of whose elements satisfy pred?.

u32vector-drop-while pred? u32vecprocedure
u32vector-drop-while-right pred? u32vecprocedure

Drops the longest initial prefix/suffix of u32vec such that all its elements satisfy pred.

u32vector-index pred? u32vec u32vec2 ...procedure
u32vector-index-right pred? u32vec u32vec2 ...procedure

Return the index of the first/last element of u32vec 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, u32vector-index stops iteration at the end of the shortest one. Lengths of vectors must be the same for u32vector-index-right.

u32vector-skip pred? u32vec u32vec2 ...procedure
u32vector-skip-right pred? u32vec u32vec2 ...procedure

Returns the index of the first/last element of u32vec 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, u32vector-skip stops iteration at the end of the shortest one. Lengths of vectors must be the same for u32vector-skip-right.

u32vector-any pred? u32vec u32vec2 ...procedure

Returns first non-false result of applying pred? on a element from the u32vec, or #f if there is no such element. If u32vec 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.

u32vector-every pred? u32vec u32vec2 ...procedure

If all elements from u32vec satisfy pred?, return the last result of pred?. If not all do, return #f. If u32vec 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.

u32vector-partition pred? u32vecprocedure

Returns an u32vector of the same type as u32vec, 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 u32vector and the number of elements satisfying pred?.

u32vector-filter pred? u32vecprocedure
u32vector-remove pred? u32vecprocedure

Return an u32vector containing the elements of u32vec that satisfy / do not satisfy pred?.

Mutators

u32vector-set! u32vec i valueprocedure

Sets the ith element of u32vec to value.

u32vector-swap! u32vec i jprocedure

Interchanges the ith and jth elements of u32vec.

u32vector-fill! u32vec fill #!optional start endprocedure

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

u32vector-reverse! u32vec #!optional start endprocedure

Reverses the portion of u32vec from start to end.

u32vector-copy! u32to at u32from #!optional start endprocedure

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

u32vector-reverse-copy! u32to at u32from #!optional start endprocedure

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

u32vector-unfold! f u32vec start end seedprocedure

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

u32vector-unfold-right! f u32vec start end seedprocedure

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

Conversion

u32vector->list u32vec #!optional start endprocedure
reverse-u32vector->list u32vec #!optional start endprocedure
list->u32vector proper-listprocedure
reverse-list->u32vector proper-listprocedure
u32vector->vector u32vec #!optional start endprocedure
vector->u32vector vec #!optional start endprocedure

Returns a list, u32vector, or heterogeneous vector with the same elements as the argument, in reverse order where specified.

Generators

make-u32vector-generator u32vectorprocedure

Returns a [[https://srfi.schemers.org/srfi-121/srfi-121.html][SRFI 121]] generator that generates all the values of u32vector in order. Note that the generator is finite.

Comparators

u32vector-comparator

Variable containing a [[https://srfi.schemers.org/srfi-128/srfi-128.html][SRFI 128]] comparator whose components provide ordering and hashing of u32vectors.

Output

write-u32vector u32vec #!optional portprocedure

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

Module (srfi 160 s32)

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] unless they are already marked with [SRFI 4]. The procedures analogous to SRFI 152 string procedures are marked with [SRFI 152].

Constructors

make-s32vector size #!optional fillprocedure

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

s32vector value ...procedure

Returns a s32vector initialized with values.

s32vector-unfold f length seedprocedure

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.

s32vector-unfold-right f length seedprocedure

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

s32vector-copy s32vec #!optional start endprocedure

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

s32vector-reverse-copy s32vec #!optional start endprocedure

The same as s32vector-copy, but in reverse order.

s32vector-append s32vec ...procedure

Returns a s32vector containing all the elements of the s32vecs in order.

s32vector-concatenate list-of-s32vectorsprocedure

The same as s32vector-append, but takes a list of s32vectors rather than multiple arguments.

(s32vector-append-subvectors [s32vec start end] ...) -> s32vector [SRFI 133]procedure

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

Predicates

s32? objprocedure

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

s32vector? objprocedure

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

s32vector-empty? s32vecprocedure

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

s32vector= s32vec ...procedure

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

Selectors

s32vector-ref s32vec iprocedure

Returns the ith element of s32vec.

s32vector-length s32vecprocedure

Returns the length of s32vec

Iteration

s32vector-take s32vec nprocedure
s32vector-take-right s32vec nprocedure

Returns a s32vector containing the first/last n elements of s32vec.

s32vector-drop s32vec nprocedure
s32vector-drop-right s32vec nprocedure

Returns a s32vector containing all except the first/last n elements of s32vec.

s32vector-segment s32vec nprocedure

Returns a list of s32vectors, each of which contains n consecutive elements of s32vec. The last s32vector may be shorter than n.

s32vector-fold kons knil s32vec s32vec2 ...procedure
s32vector-fold-right kons knil s32vec s32vec2 ...procedure

When one s32vector argument s32vec is given, folds kons over the elements of s32vec in increasing/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 s32vector arguments are given, kons is called with the current state value and each value from all the vectors; s32vector-fold scans elements from left to right, while s32vector-fold-right does 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.

s32vector-map f s32vec s32vec2 ...procedure
s32vector-map! f s32vec s32vec2 ...procedure
s32vector-for-each f s32vec s32vec2 ...procedure

Iterate over the elements of s32vec and apply f to each, returning respectively a s32vector of the results, an undefined value with the results placed back in s32vec, and an undefined value with no change to s32vec.

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. For s32vector-map!, only s32vec is modified even when multiple vectors are passed.

If s32vector-map or s32vector-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.

s32vector-count pred? s32vec s32vec2 ...procedure

Call pred? on each element of s32vec 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.

s32vector-cumulate f knil s32vecprocedure

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

Searching

s32vector-take-while pred? s32vecprocedure
s32vector-take-while-right pred? s32vecprocedure

Return the shortest prefix/suffix of s32vec all of whose elements satisfy pred?.

s32vector-drop-while pred? s32vecprocedure
s32vector-drop-while-right pred? s32vecprocedure

Drops the longest initial prefix/suffix of s32vec such that all its elements satisfy pred.

s32vector-index pred? s32vec s32vec2 ...procedure
s32vector-index-right pred? s32vec s32vec2 ...procedure

Return the index of the first/last element of s32vec 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, s32vector-index stops iteration at the end of the shortest one. Lengths of vectors must be the same for s32vector-index-right.

s32vector-skip pred? s32vec s32vec2 ...procedure
s32vector-skip-right pred? s32vec s32vec2 ...procedure

Returns the index of the first/last element of s32vec 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, s32vector-skip stops iteration at the end of the shortest one. Lengths of vectors must be the same for s32vector-skip-right.

s32vector-any pred? s32vec s32vec2 ...procedure

Returns first non-false result of applying pred? on a element from the s32vec, or #f if there is no such element. If s32vec 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.

s32vector-every pred? s32vec s32vec2 ...procedure

If all elements from s32vec satisfy pred?, return the last result of pred?. If not all do, return #f. If s32vec 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.

s32vector-partition pred? s32vecprocedure

Returns an s32vector of the same type as s32vec, 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 s32vector and the number of elements satisfying pred?.

s32vector-filter pred? s32vecprocedure
s32vector-remove pred? s32vecprocedure

Return an s32vector containing the elements of s32vec that satisfy / do not satisfy pred?.

Mutators

s32vector-set! s32vec i valueprocedure

Sets the ith element of s32vec to value.

s32vector-swap! s32vec i jprocedure

Interchanges the ith and jth elements of s32vec.

s32vector-fill! s32vec fill #!optional start endprocedure

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

s32vector-reverse! s32vec #!optional start endprocedure

Reverses the portion of s32vec from start to end.

s32vector-copy! s32to at s32from #!optional start endprocedure

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

s32vector-reverse-copy! s32to at s32from #!optional start endprocedure

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

s32vector-unfold! f s32vec start end seedprocedure

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

s32vector-unfold-right! f s32vec start end seedprocedure

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

Conversion

s32vector->list s32vec #!optional start endprocedure
reverse-s32vector->list s32vec #!optional start endprocedure
list->s32vector proper-listprocedure
reverse-list->s32vector proper-listprocedure
s32vector->vector s32vec #!optional start endprocedure
vector->s32vector vec #!optional start endprocedure

Returns a list, s32vector, or heterogeneous vector with the same elements as the argument, in reverse order where specified.

Generators

make-s32vector-generator s32vectorprocedure

Returns a [[https://srfi.schemers.org/srfi-121/srfi-121.html][SRFI 121]] generator that generates all the values of s32vector in order. Note that the generator is finite.

Comparators

s32vector-comparator

Variable containing a [[https://srfi.schemers.org/srfi-128/srfi-128.html][SRFI 128]] comparator whose components provide ordering and hashing of s32vectors.

Output

write-s32vector s32vec #!optional portprocedure

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

Module (srfi 160 u64)

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] unless they are already marked with [SRFI 4]. The procedures analogous to SRFI 152 string procedures are marked with [SRFI 152].

Constructors

make-u64vector size #!optional fillprocedure

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

u64vector value ...procedure

Returns a u64vector initialized with values.

u64vector-unfold f length seedprocedure

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.

u64vector-unfold-right f length seedprocedure

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

u64vector-copy u64vec #!optional start endprocedure

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

u64vector-reverse-copy u64vec #!optional start endprocedure

The same as u64vector-copy, but in reverse order.

u64vector-append u64vec ...procedure

Returns a u64vector containing all the elements of the u64vecs in order.

u64vector-concatenate list-of-u64vectorsprocedure

The same as u64vector-append, but takes a list of u64vectors rather than multiple arguments.

(u64vector-append-subvectors [u64vec start end] ...) -> u64vector [SRFI 133]procedure

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

Predicates

u64? objprocedure

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

u64vector? objprocedure

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

u64vector-empty? u64vecprocedure

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

u64vector= u64vec ...procedure

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

Selectors

u64vector-ref u64vec iprocedure

Returns the ith element of u64vec.

u64vector-length u64vecprocedure

Returns the length of u64vec

Iteration

u64vector-take u64vec nprocedure
u64vector-take-right u64vec nprocedure

Returns a u64vector containing the first/last n elements of u64vec.

u64vector-drop u64vec nprocedure
u64vector-drop-right u64vec nprocedure

Returns a u64vector containing all except the first/last n elements of u64vec.

u64vector-segment u64vec nprocedure

Returns a list of u64vectors, each of which contains n consecutive elements of u64vec. The last u64vector may be shorter than n.

u64vector-fold kons knil u64vec u64vec2 ...procedure
u64vector-fold-right kons knil u64vec u64vec2 ...procedure

When one u64vector argument u64vec is given, folds kons over the elements of u64vec in increasing/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 u64vector arguments are given, kons is called with the current state value and each value from all the vectors; u64vector-fold scans elements from left to right, while u64vector-fold-right does 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.

u64vector-map f u64vec u64vec2 ...procedure
u64vector-map! f u64vec u64vec2 ...procedure
u64vector-for-each f u64vec u64vec2 ...procedure

Iterate over the elements of u64vec and apply f to each, returning respectively a u64vector of the results, an undefined value with the results placed back in u64vec, and an undefined value with no change to u64vec.

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. For u64vector-map!, only u64vec is modified even when multiple vectors are passed.

If u64vector-map or u64vector-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.

u64vector-count pred? u64vec u64vec2 ...procedure

Call pred? on each element of u64vec 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.

u64vector-cumulate f knil u64vecprocedure

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

Searching

u64vector-take-while pred? u64vecprocedure
u64vector-take-while-right pred? u64vecprocedure

Return the shortest prefix/suffix of u64vec all of whose elements satisfy pred?.

u64vector-drop-while pred? u64vecprocedure
u64vector-drop-while-right pred? u64vecprocedure

Drops the longest initial prefix/suffix of u64vec such that all its elements satisfy pred.

u64vector-index pred? u64vec u64vec2 ...procedure
u64vector-index-right pred? u64vec u64vec2 ...procedure

Return the index of the first/last element of u64vec 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, u64vector-index stops iteration at the end of the shortest one. Lengths of vectors must be the same for u64vector-index-right.

u64vector-skip pred? u64vec u64vec2 ...procedure
u64vector-skip-right pred? u64vec u64vec2 ...procedure

Returns the index of the first/last element of u64vec 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, u64vector-skip stops iteration at the end of the shortest one. Lengths of vectors must be the same for u64vector-skip-right.

u64vector-any pred? u64vec u64vec2 ...procedure

Returns first non-false result of applying pred? on a element from the u64vec, or #f if there is no such element. If u64vec 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.

u64vector-every pred? u64vec u64vec2 ...procedure

If all elements from u64vec satisfy pred?, return the last result of pred?. If not all do, return #f. If u64vec 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.

u64vector-partition pred? u64vecprocedure

Returns an u64vector of the same type as u64vec, 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 u64vector and the number of elements satisfying pred?.

u64vector-filter pred? u64vecprocedure
u64vector-remove pred? u64vecprocedure

Return an u64vector containing the elements of u64vec that satisfy / do not satisfy pred?.

Mutators

u64vector-set! u64vec i valueprocedure

Sets the ith element of u64vec to value.

u64vector-swap! u64vec i jprocedure

Interchanges the ith and jth elements of u64vec.

u64vector-fill! u64vec fill #!optional start endprocedure

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

u64vector-reverse! u64vec #!optional start endprocedure

Reverses the portion of u64vec from start to end.

u64vector-copy! u64to at u64from #!optional start endprocedure

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

u64vector-reverse-copy! u64to at u64from #!optional start endprocedure

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

u64vector-unfold! f u64vec start end seedprocedure

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

u64vector-unfold-right! f u64vec start end seedprocedure

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

Conversion

u64vector->list u64vec #!optional start endprocedure
reverse-u64vector->list u64vec #!optional start endprocedure
list->u64vector proper-listprocedure
reverse-list->u64vector proper-listprocedure
u64vector->vector u64vec #!optional start endprocedure
vector->u64vector vec #!optional start endprocedure

Returns a list, u64vector, or heterogeneous vector with the same elements as the argument, in reverse order where specified.

Generators

make-u64vector-generator u64vectorprocedure

Returns a [[https://srfi.schemers.org/srfi-121/srfi-121.html][SRFI 121]] generator that generates all the values of u64vector in order. Note that the generator is finite.

Comparators

u64vector-comparator

Variable containing a [[https://srfi.schemers.org/srfi-128/srfi-128.html][SRFI 128]] comparator whose components provide ordering and hashing of u64vectors.

Output

write-u64vector u64vec #!optional portprocedure

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

Module (srfi 160 s64)

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] unless they are already marked with [SRFI 4]. The procedures analogous to SRFI 152 string procedures are marked with [SRFI 152].

Constructors

make-s64vector size #!optional fillprocedure

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

s64vector value ...procedure

Returns a s64vector initialized with values.

s64vector-unfold f length seedprocedure

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.

s64vector-unfold-right f length seedprocedure

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

s64vector-copy s64vec #!optional start endprocedure

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

s64vector-reverse-copy s64vec #!optional start endprocedure

The same as s64vector-copy, but in reverse order.

s64vector-append s64vec ...procedure

Returns a s64vector containing all the elements of the s64vecs in order.

s64vector-concatenate list-of-s64vectorsprocedure

The same as s64vector-append, but takes a list of s64vectors rather than multiple arguments.

(s64vector-append-subvectors [s64vec start end] ...) -> s64vector [SRFI 133]procedure

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

Predicates

s64? objprocedure

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

s64vector? objprocedure

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

s64vector-empty? s64vecprocedure

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

s64vector= s64vec ...procedure

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

Selectors

s64vector-ref s64vec iprocedure

Returns the ith element of s64vec.

s64vector-length s64vecprocedure

Returns the length of s64vec

Iteration

s64vector-take s64vec nprocedure
s64vector-take-right s64vec nprocedure

Returns a s64vector containing the first/last n elements of s64vec.

s64vector-drop s64vec nprocedure
s64vector-drop-right s64vec nprocedure

Returns a s64vector containing all except the first/last n elements of s64vec.

s64vector-segment s64vec nprocedure

Returns a list of s64vectors, each of which contains n consecutive elements of s64vec. The last s64vector may be shorter than n.

s64vector-fold kons knil s64vec s64vec2 ...procedure
s64vector-fold-right kons knil s64vec s64vec2 ...procedure

When one s64vector argument s64vec is given, folds kons over the elements of s64vec in increasing/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 s64vector arguments are given, kons is called with the current state value and each value from all the vectors; s64vector-fold scans elements from left to right, while s64vector-fold-right does 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.

s64vector-map f s64vec s64vec2 ...procedure
s64vector-map! f s64vec s64vec2 ...procedure
s64vector-for-each f s64vec s64vec2 ...procedure

Iterate over the elements of s64vec and apply f to each, returning respectively a s64vector of the results, an undefined value with the results placed back in s64vec, and an undefined value with no change to s64vec.

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. For s64vector-map!, only s64vec is modified even when multiple vectors are passed.

If s64vector-map or s64vector-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.

s64vector-count pred? s64vec s64vec2 ...procedure

Call pred? on each element of s64vec 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.

s64vector-cumulate f knil s64vecprocedure

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

Searching

s64vector-take-while pred? s64vecprocedure
s64vector-take-while-right pred? s64vecprocedure

Return the shortest prefix/suffix of s64vec all of whose elements satisfy pred?.

s64vector-drop-while pred? s64vecprocedure
s64vector-drop-while-right pred? s64vecprocedure

Drops the longest initial prefix/suffix of s64vec such that all its elements satisfy pred.

s64vector-index pred? s64vec s64vec2 ...procedure
s64vector-index-right pred? s64vec s64vec2 ...procedure

Return the index of the first/last element of s64vec 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, s64vector-index stops iteration at the end of the shortest one. Lengths of vectors must be the same for s64vector-index-right.

s64vector-skip pred? s64vec s64vec2 ...procedure
s64vector-skip-right pred? s64vec s64vec2 ...procedure

Returns the index of the first/last element of s64vec 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, s64vector-skip stops iteration at the end of the shortest one. Lengths of vectors must be the same for s64vector-skip-right.

s64vector-any pred? s64vec s64vec2 ...procedure

Returns first non-false result of applying pred? on a element from the s64vec, or #f if there is no such element. If s64vec 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.

s64vector-every pred? s64vec s64vec2 ...procedure

If all elements from s64vec satisfy pred?, return the last result of pred?. If not all do, return #f. If s64vec 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.

s64vector-partition pred? s64vecprocedure

Returns an s64vector of the same type as s64vec, 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 s64vector and the number of elements satisfying pred?.

s64vector-filter pred? s64vecprocedure
s64vector-remove pred? s64vecprocedure

Return an s64vector containing the elements of s64vec that satisfy / do not satisfy pred?.

Mutators

s64vector-set! s64vec i valueprocedure

Sets the ith element of s64vec to value.

s64vector-swap! s64vec i jprocedure

Interchanges the ith and jth elements of s64vec.

s64vector-fill! s64vec fill #!optional start endprocedure

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

s64vector-reverse! s64vec #!optional start endprocedure

Reverses the portion of s64vec from start to end.

s64vector-copy! s64to at s64from #!optional start endprocedure

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

s64vector-reverse-copy! s64to at s64from #!optional start endprocedure

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

s64vector-unfold! f s64vec start end seedprocedure

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

s64vector-unfold-right! f s64vec start end seedprocedure

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

Conversion

s64vector->list s64vec #!optional start endprocedure
reverse-s64vector->list s64vec #!optional start endprocedure
list->s64vector proper-listprocedure
reverse-list->s64vector proper-listprocedure
s64vector->vector s64vec #!optional start endprocedure
vector->s64vector vec #!optional start endprocedure

Returns a list, s64vector, or heterogeneous vector with the same elements as the argument, in reverse order where specified.

Generators

make-s64vector-generator s64vectorprocedure

Returns a [[https://srfi.schemers.org/srfi-121/srfi-121.html][SRFI 121]] generator that generates all the values of s64vector in order. Note that the generator is finite.

Comparators

s64vector-comparator

Variable containing a [[https://srfi.schemers.org/srfi-128/srfi-128.html][SRFI 128]] comparator whose components provide ordering and hashing of s64vectors.

Output

write-s64vector s64vec #!optional portprocedure

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

Module (srfi 160 f32)

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] unless they are already marked with [SRFI 4]. The procedures analogous to SRFI 152 string procedures are marked with [SRFI 152].

Constructors

make-f32vector size #!optional fillprocedure

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

f32vector value ...procedure

Returns a f32vector initialized with values.

f32vector-unfold f length seedprocedure

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.

f32vector-unfold-right f length seedprocedure

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

f32vector-copy f32vec #!optional start endprocedure

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

f32vector-reverse-copy f32vec #!optional start endprocedure

The same as f32vector-copy, but in reverse order.

f32vector-append f32vec ...procedure

Returns a f32vector containing all the elements of the f32vecs in order.

f32vector-concatenate list-of-f32vectorsprocedure

The same as f32vector-append, but takes a list of f32vectors rather than multiple arguments.

(f32vector-append-subvectors [f32vec start end] ...) -> f32vector [SRFI 133]procedure

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

Predicates

f32? objprocedure

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

f32vector? objprocedure

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

f32vector-empty? f32vecprocedure

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

f32vector= f32vec ...procedure

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

Selectors

f32vector-ref f32vec iprocedure

Returns the ith element of f32vec.

f32vector-length f32vecprocedure

Returns the length of f32vec

Iteration

f32vector-take f32vec nprocedure
f32vector-take-right f32vec nprocedure

Returns a f32vector containing the first/last n elements of f32vec.

f32vector-drop f32vec nprocedure
f32vector-drop-right f32vec nprocedure

Returns a f32vector containing all except the first/last n elements of f32vec.

f32vector-segment f32vec nprocedure

Returns a list of f32vectors, each of which contains n consecutive elements of f32vec. The last f32vector may be shorter than n.

f32vector-fold kons knil f32vec f32vec2 ...procedure
f32vector-fold-right kons knil f32vec f32vec2 ...procedure

When one f32vector argument f32vec is given, folds kons over the elements of f32vec in increasing/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 f32vector arguments are given, kons is called with the current state value and each value from all the vectors; f32vector-fold scans elements from left to right, while f32vector-fold-right does 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.

f32vector-map f f32vec f32vec2 ...procedure
f32vector-map! f f32vec f32vec2 ...procedure
f32vector-for-each f f32vec f32vec2 ...procedure

Iterate over the elements of f32vec and apply f to each, returning respectively a f32vector of the results, an undefined value with the results placed back in f32vec, and an undefined value with no change to f32vec.

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. For f32vector-map!, only f32vec is modified even when multiple vectors are passed.

If f32vector-map or f32vector-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.

f32vector-count pred? f32vec f32vec2 ...procedure

Call pred? on each element of f32vec 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.

f32vector-cumulate f knil f32vecprocedure

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

Searching

f32vector-take-while pred? f32vecprocedure
f32vector-take-while-right pred? f32vecprocedure

Return the shortest prefix/suffix of f32vec all of whose elements satisfy pred?.

f32vector-drop-while pred? f32vecprocedure
f32vector-drop-while-right pred? f32vecprocedure

Drops the longest initial prefix/suffix of f32vec such that all its elements satisfy pred.

f32vector-index pred? f32vec f32vec2 ...procedure
f32vector-index-right pred? f32vec f32vec2 ...procedure

Return the index of the first/last element of f32vec 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, f32vector-index stops iteration at the end of the shortest one. Lengths of vectors must be the same for f32vector-index-right.

f32vector-skip pred? f32vec f32vec2 ...procedure
f32vector-skip-right pred? f32vec f32vec2 ...procedure

Returns the index of the first/last element of f32vec 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, f32vector-skip stops iteration at the end of the shortest one. Lengths of vectors must be the same for f32vector-skip-right.

f32vector-any pred? f32vec f32vec2 ...procedure

Returns first non-false result of applying pred? on a element from the f32vec, or #f if there is no such element. If f32vec 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.

f32vector-every pred? f32vec f32vec2 ...procedure

If all elements from f32vec satisfy pred?, return the last result of pred?. If not all do, return #f. If f32vec 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.

f32vector-partition pred? f32vecprocedure

Returns an f32vector of the same type as f32vec, 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 f32vector and the number of elements satisfying pred?.

f32vector-filter pred? f32vecprocedure
f32vector-remove pred? f32vecprocedure

Return an f32vector containing the elements of f32vec that satisfy / do not satisfy pred?.

Mutators

f32vector-set! f32vec i valueprocedure

Sets the ith element of f32vec to value.

f32vector-swap! f32vec i jprocedure

Interchanges the ith and jth elements of f32vec.

f32vector-fill! f32vec fill #!optional start endprocedure

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

f32vector-reverse! f32vec #!optional start endprocedure

Reverses the portion of f32vec from start to end.

f32vector-copy! f32to at f32from #!optional start endprocedure

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

f32vector-reverse-copy! f32to at f32from #!optional start endprocedure

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

f32vector-unfold! f f32vec start end seedprocedure

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

f32vector-unfold-right! f f32vec start end seedprocedure

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

Conversion

f32vector->list f32vec #!optional start endprocedure
reverse-f32vector->list f32vec #!optional start endprocedure
list->f32vector proper-listprocedure
reverse-list->f32vector proper-listprocedure
f32vector->vector f32vec #!optional start endprocedure
vector->f32vector vec #!optional start endprocedure

Returns a list, f32vector, or heterogeneous vector with the same elements as the argument, in reverse order where specified.

Generators

make-f32vector-generator f32vectorprocedure

Returns a [[https://srfi.schemers.org/srfi-121/srfi-121.html][SRFI 121]] generator that generates all the values of f32vector in order. Note that the generator is finite.

Comparators

f32vector-comparator

Variable containing a [[https://srfi.schemers.org/srfi-128/srfi-128.html][SRFI 128]] comparator whose components provide ordering and hashing of f32vectors.

Output

write-f32vector f32vec #!optional portprocedure

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

Module (srfi 160 f64)

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] unless they are already marked with [SRFI 4]. The procedures analogous to SRFI 152 string procedures are marked with [SRFI 152].

Constructors

make-f64vector size #!optional fillprocedure

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

f64vector value ...procedure

Returns a f64vector initialized with values.

f64vector-unfold f length seedprocedure

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.

f64vector-unfold-right f length seedprocedure

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

f64vector-copy f64vec #!optional start endprocedure

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

f64vector-reverse-copy f64vec #!optional start endprocedure

The same as f64vector-copy, but in reverse order.

f64vector-append f64vec ...procedure

Returns a f64vector containing all the elements of the f64vecs in order.

f64vector-concatenate list-of-f64vectorsprocedure

The same as f64vector-append, but takes a list of f64vectors rather than multiple arguments.

(f64vector-append-subvectors [f64vec start end] ...) -> f64vector [SRFI 133]procedure

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

Predicates

f64? objprocedure

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

f64vector? objprocedure

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

f64vector-empty? f64vecprocedure

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

f64vector= f64vec ...procedure

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

Selectors

f64vector-ref f64vec iprocedure

Returns the ith element of f64vec.

f64vector-length f64vecprocedure

Returns the length of f64vec

Iteration

f64vector-take f64vec nprocedure
f64vector-take-right f64vec nprocedure

Returns a f64vector containing the first/last n elements of f64vec.

f64vector-drop f64vec nprocedure
f64vector-drop-right f64vec nprocedure

Returns a f64vector containing all except the first/last n elements of f64vec.

f64vector-segment f64vec nprocedure

Returns a list of f64vectors, each of which contains n consecutive elements of f64vec. The last f64vector may be shorter than n.

f64vector-fold kons knil f64vec f64vec2 ...procedure
f64vector-fold-right kons knil f64vec f64vec2 ...procedure

When one f64vector argument f64vec is given, folds kons over the elements of f64vec in increasing/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 f64vector arguments are given, kons is called with the current state value and each value from all the vectors; f64vector-fold scans elements from left to right, while f64vector-fold-right does 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.

f64vector-map f f64vec f64vec2 ...procedure
f64vector-map! f f64vec f64vec2 ...procedure
f64vector-for-each f f64vec f64vec2 ...procedure

Iterate over the elements of f64vec and apply f to each, returning respectively a f64vector of the results, an undefined value with the results placed back in f64vec, and an undefined value with no change to f64vec.

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. For f64vector-map!, only f64vec is modified even when multiple vectors are passed.

If f64vector-map or f64vector-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.

f64vector-count pred? f64vec f64vec2 ...procedure

Call pred? on each element of f64vec 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.

f64vector-cumulate f knil f64vecprocedure

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

Searching

f64vector-take-while pred? f64vecprocedure
f64vector-take-while-right pred? f64vecprocedure

Return the shortest prefix/suffix of f64vec all of whose elements satisfy pred?.

f64vector-drop-while pred? f64vecprocedure
f64vector-drop-while-right pred? f64vecprocedure

Drops the longest initial prefix/suffix of f64vec such that all its elements satisfy pred.

f64vector-index pred? f64vec f64vec2 ...procedure
f64vector-index-right pred? f64vec f64vec2 ...procedure

Return the index of the first/last element of f64vec 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, f64vector-index stops iteration at the end of the shortest one. Lengths of vectors must be the same for f64vector-index-right.

f64vector-skip pred? f64vec f64vec2 ...procedure
f64vector-skip-right pred? f64vec f64vec2 ...procedure

Returns the index of the first/last element of f64vec 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, f64vector-skip stops iteration at the end of the shortest one. Lengths of vectors must be the same for f64vector-skip-right.

f64vector-any pred? f64vec f64vec2 ...procedure

Returns first non-false result of applying pred? on a element from the f64vec, or #f if there is no such element. If f64vec 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.

f64vector-every pred? f64vec f64vec2 ...procedure

If all elements from f64vec satisfy pred?, return the last result of pred?. If not all do, return #f. If f64vec 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.

f64vector-partition pred? f64vecprocedure

Returns an f64vector of the same type as f64vec, 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 f64vector and the number of elements satisfying pred?.

f64vector-filter pred? f64vecprocedure
f64vector-remove pred? f64vecprocedure

Return an f64vector containing the elements of f64vec that satisfy / do not satisfy pred?.

Mutators

f64vector-set! f64vec i valueprocedure

Sets the ith element of f64vec to value.

f64vector-swap! f64vec i jprocedure

Interchanges the ith and jth elements of f64vec.

f64vector-fill! f64vec fill #!optional start endprocedure

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

f64vector-reverse! f64vec #!optional start endprocedure

Reverses the portion of f64vec from start to end.

f64vector-copy! f64to at f64from #!optional start endprocedure

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

f64vector-reverse-copy! f64to at f64from #!optional start endprocedure

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

f64vector-unfold! f f64vec start end seedprocedure

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

f64vector-unfold-right! f f64vec start end seedprocedure

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

Conversion

f64vector->list f64vec #!optional start endprocedure
reverse-f64vector->list f64vec #!optional start endprocedure
list->f64vector proper-listprocedure
reverse-list->f64vector proper-listprocedure
f64vector->vector f64vec #!optional start endprocedure
vector->f64vector vec #!optional start endprocedure

Returns a list, f64vector, or heterogeneous vector with the same elements as the argument, in reverse order where specified.

Generators

make-f64vector-generator f64vectorprocedure

Returns a [[https://srfi.schemers.org/srfi-121/srfi-121.html][SRFI 121]] generator that generates all the values of f64vector in order. Note that the generator is finite.

Comparators

f64vector-comparator

Variable containing a [[https://srfi.schemers.org/srfi-128/srfi-128.html][SRFI 128]] comparator whose components provide ordering and hashing of f64vectors.

Output

write-f64vector f64vec #!optional portprocedure

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

Module (srfi 160 c64)

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] unless they are already marked with [SRFI 4]. The procedures analogous to SRFI 152 string procedures are marked with [SRFI 152].

Constructors

make-c64vector size #!optional fillprocedure

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

c64vector value ...procedure

Returns a c64vector initialized with values.

c64vector-unfold f length seedprocedure

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.

c64vector-unfold-right f length seedprocedure

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

c64vector-copy c64vec #!optional start endprocedure

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

c64vector-reverse-copy c64vec #!optional start endprocedure

The same as c64vector-copy, but in reverse order.

c64vector-append c64vec ...procedure

Returns a c64vector containing all the elements of the c64vecs in order.

c64vector-concatenate list-of-c64vectorsprocedure

The same as c64vector-append, but takes a list of c64vectors rather than multiple arguments.

(c64vector-append-subvectors [c64vec start end] ...) -> c64vector [SRFI 133]procedure

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

Predicates

c64? objprocedure

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

c64vector? objprocedure

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

c64vector-empty? c64vecprocedure

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

c64vector= c64vec ...procedure

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

Selectors

c64vector-ref c64vec iprocedure

Returns the ith element of c64vec.

c64vector-length c64vecprocedure

Returns the length of c64vec

Iteration

c64vector-take c64vec nprocedure
c64vector-take-right c64vec nprocedure

Returns a c64vector containing the first/last n elements of c64vec.

c64vector-drop c64vec nprocedure
c64vector-drop-right c64vec nprocedure

Returns a c64vector containing all except the first/last n elements of c64vec.

c64vector-segment c64vec nprocedure

Returns a list of c64vectors, each of which contains n consecutive elements of c64vec. The last c64vector may be shorter than n.

c64vector-fold kons knil c64vec c64vec2 ...procedure
c64vector-fold-right kons knil c64vec c64vec2 ...procedure

When one c64vector argument c64vec is given, folds kons over the elements of c64vec in increasing/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 c64vector arguments are given, kons is called with the current state value and each value from all the vectors; c64vector-fold scans elements from left to right, while c64vector-fold-right does 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.

c64vector-map f c64vec c64vec2 ...procedure
c64vector-map! f c64vec c64vec2 ...procedure
c64vector-for-each f c64vec c64vec2 ...procedure

Iterate over the elements of c64vec and apply f to each, returning respectively a c64vector of the results, an undefined value with the results placed back in c64vec, and an undefined value with no change to c64vec.

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. For c64vector-map!, only c64vec is modified even when multiple vectors are passed.

If c64vector-map or c64vector-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.

c64vector-count pred? c64vec c64vec2 ...procedure

Call pred? on each element of c64vec 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.

c64vector-cumulate f knil c64vecprocedure

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

Searching

c64vector-take-while pred? c64vecprocedure
c64vector-take-while-right pred? c64vecprocedure

Return the shortest prefix/suffix of c64vec all of whose elements satisfy pred?.

c64vector-drop-while pred? c64vecprocedure
c64vector-drop-while-right pred? c64vecprocedure

Drops the longest initial prefix/suffix of c64vec such that all its elements satisfy pred.

c64vector-index pred? c64vec c64vec2 ...procedure
c64vector-index-right pred? c64vec c64vec2 ...procedure

Return the index of the first/last element of c64vec 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, c64vector-index stops iteration at the end of the shortest one. Lengths of vectors must be the same for c64vector-index-right.

c64vector-skip pred? c64vec c64vec2 ...procedure
c64vector-skip-right pred? c64vec c64vec2 ...procedure

Returns the index of the first/last element of c64vec 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, c64vector-skip stops iteration at the end of the shortest one. Lengths of vectors must be the same for c64vector-skip-right.

c64vector-any pred? c64vec c64vec2 ...procedure

Returns first non-false result of applying pred? on a element from the c64vec, or #f if there is no such element. If c64vec 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.

c64vector-every pred? c64vec c64vec2 ...procedure

If all elements from c64vec satisfy pred?, return the last result of pred?. If not all do, return #f. If c64vec 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.

c64vector-partition pred? c64vecprocedure

Returns an c64vector of the same type as c64vec, 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 c64vector and the number of elements satisfying pred?.

c64vector-filter pred? c64vecprocedure
c64vector-remove pred? c64vecprocedure

Return an c64vector containing the elements of c64vec that satisfy / do not satisfy pred?.

Mutators

c64vector-set! c64vec i valueprocedure

Sets the ith element of c64vec to value.

c64vector-swap! c64vec i jprocedure

Interchanges the ith and jth elements of c64vec.

c64vector-fill! c64vec fill #!optional start endprocedure

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

c64vector-reverse! c64vec #!optional start endprocedure

Reverses the portion of c64vec from start to end.

c64vector-copy! c64to at c64from #!optional start endprocedure

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

c64vector-reverse-copy! c64to at c64from #!optional start endprocedure

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

c64vector-unfold! f c64vec start end seedprocedure

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

c64vector-unfold-right! f c64vec start end seedprocedure

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

Conversion

c64vector->list c64vec #!optional start endprocedure
reverse-c64vector->list c64vec #!optional start endprocedure
list->c64vector proper-listprocedure
reverse-list->c64vector proper-listprocedure
c64vector->vector c64vec #!optional start endprocedure
vector->c64vector vec #!optional start endprocedure

Returns a list, c64vector, or heterogeneous vector with the same elements as the argument, in reverse order where specified.

Generators

make-c64vector-generator c64vectorprocedure

Returns a [[https://srfi.schemers.org/srfi-121/srfi-121.html][SRFI 121]] generator that generates all the values of c64vector in order. Note that the generator is finite.

Comparators

c64vector-comparator

Variable containing a [[https://srfi.schemers.org/srfi-128/srfi-128.html][SRFI 128]] comparator whose components provide ordering and hashing of c64vectors.

Output

write-c64vector c64vec #!optional portprocedure

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

Module (srfi 160 c128)

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] unless they are already marked with [SRFI 4]. The procedures analogous to SRFI 152 string procedures are marked with [SRFI 152].

Constructors

make-c128vector size #!optional fillprocedure

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

c128vector value ...procedure

Returns a c128vector initialized with values.

c128vector-unfold f length seedprocedure

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.

c128vector-unfold-right f length seedprocedure

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

c128vector-copy c128vec #!optional start endprocedure

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

c128vector-reverse-copy c128vec #!optional start endprocedure

The same as c128vector-copy, but in reverse order.

c128vector-append c128vec ...procedure

Returns a c128vector containing all the elements of the c128vecs in order.

c128vector-concatenate list-of-c128vectorsprocedure

The same as c128vector-append, but takes a list of c128vectors rather than multiple arguments.

(c128vector-append-subvectors [c128vec start end] ...) -> c128vector [SRFI 133]procedure

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

Predicates

c128? objprocedure

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

c128vector? objprocedure

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

c128vector-empty? c128vecprocedure

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

c128vector= c128vec ...procedure

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

Selectors

c128vector-ref c128vec iprocedure

Returns the ith element of c128vec.

c128vector-length c128vecprocedure

Returns the length of c128vec

Iteration

c128vector-take c128vec nprocedure
c128vector-take-right c128vec nprocedure

Returns a c128vector containing the first/last n elements of c128vec.

c128vector-drop c128vec nprocedure
c128vector-drop-right c128vec nprocedure

Returns a c128vector containing all except the first/last n elements of c128vec.

c128vector-segment c128vec nprocedure

Returns a list of c128vectors, each of which contains n consecutive elements of c128vec. The last c128vector may be shorter than n.

c128vector-fold kons knil c128vec c128vec2 ...procedure
c128vector-fold-right kons knil c128vec c128vec2 ...procedure

When one c128vector argument c128vec is given, folds kons over the elements of c128vec in increasing/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 c128vector arguments are given, kons is called with the current state value and each value from all the vectors; c128vector-fold scans elements from left to right, while c128vector-fold-right does 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.

c128vector-map f c128vec c128vec2 ...procedure
c128vector-map! f c128vec c128vec2 ...procedure
c128vector-for-each f c128vec c128vec2 ...procedure

Iterate over the elements of c128vec and apply f to each, returning respectively a c128vector of the results, an undefined value with the results placed back in c128vec, and an undefined value with no change to c128vec.

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. For c128vector-map!, only c128vec is modified even when multiple vectors are passed.

If c128vector-map or c128vector-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.

c128vector-count pred? c128vec c128vec2 ...procedure

Call pred? on each element of c128vec 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.

c128vector-cumulate f knil c128vecprocedure

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

Searching

c128vector-take-while pred? c128vecprocedure
c128vector-take-while-right pred? c128vecprocedure

Return the shortest prefix/suffix of c128vec all of whose elements satisfy pred?.

c128vector-drop-while pred? c128vecprocedure
c128vector-drop-while-right pred? c128vecprocedure

Drops the longest initial prefix/suffix of c128vec such that all its elements satisfy pred.

c128vector-index pred? c128vec c128vec2 ...procedure
c128vector-index-right pred? c128vec c128vec2 ...procedure

Return the index of the first/last element of c128vec 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, c128vector-index stops iteration at the end of the shortest one. Lengths of vectors must be the same for c128vector-index-right.

c128vector-skip pred? c128vec c128vec2 ...procedure
c128vector-skip-right pred? c128vec c128vec2 ...procedure

Returns the index of the first/last element of c128vec 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, c128vector-skip stops iteration at the end of the shortest one. Lengths of vectors must be the same for c128vector-skip-right.

c128vector-any pred? c128vec c128vec2 ...procedure

Returns first non-false result of applying pred? on a element from the c128vec, or #f if there is no such element. If c128vec 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.

c128vector-every pred? c128vec c128vec2 ...procedure

If all elements from c128vec satisfy pred?, return the last result of pred?. If not all do, return #f. If c128vec 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.

c128vector-partition pred? c128vecprocedure

Returns an c128vector of the same type as c128vec, 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 c128vector and the number of elements satisfying pred?.

c128vector-filter pred? c128vecprocedure
c128vector-remove pred? c128vecprocedure

Return an c128vector containing the elements of c128vec that satisfy / do not satisfy pred?.

Mutators

c128vector-set! c128vec i valueprocedure

Sets the ith element of c128vec to value.

c128vector-swap! c128vec i jprocedure

Interchanges the ith and jth elements of c128vec.

c128vector-fill! c128vec fill #!optional start endprocedure

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

c128vector-reverse! c128vec #!optional start endprocedure

Reverses the portion of c128vec from start to end.

c128vector-copy! c128to at c128from #!optional start endprocedure

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

c128vector-reverse-copy! c128to at c128from #!optional start endprocedure

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

c128vector-unfold! f c128vec start end seedprocedure

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

c128vector-unfold-right! f c128vec start end seedprocedure

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

Conversion

c128vector->list c128vec #!optional start endprocedure
reverse-c128vector->list c128vec #!optional start endprocedure
list->c128vector proper-listprocedure
reverse-list->c128vector proper-listprocedure
c128vector->vector c128vec #!optional start endprocedure
vector->c128vector vec #!optional start endprocedure

Returns a list, c128vector, or heterogeneous vector with the same elements as the argument, in reverse order where specified.

Generators

make-c128vector-generator c128vectorprocedure

Returns a [[https://srfi.schemers.org/srfi-121/srfi-121.html][SRFI 121]] generator that generates all the values of c128vector in order. Note that the generator is finite.

Comparators

c128vector-comparator

Variable containing a [[https://srfi.schemers.org/srfi-128/srfi-128.html][SRFI 128]] comparator whose components provide ordering and hashing of c128vectors.

Output

write-c128vector c128vec #!optional portprocedure

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

Optional lexical syntax

Each homogeneous vector datatype has an external representation which may be supported by the read and write procedures and by the program parser. Conformance to this SRFI does not in itself require support for these external representations.

For each value of @ in { s8, u8, s16, u16, s32, u32, s64, u64, f32, f64, c64, c128 }, if the datatype @vector is supported, then the external representation of instances of the datatype @vector is #@( ...elements... ).

For example, #u8(0 #e1e2 #xff) is a u8vector of length 3 containing 0, 100 and 255; #f64(-1.5) is an f64vector of length 1 containing -1.5.

Note that the syntax for float vectors conflicts with R5RS, which parses #f32() as 3 objects: #f, 32 and (). For this reason, conformance to this SRFI implies this minor nonconformance to R5RS.

This external representation is also available in program source code. For example, (set! x '#u8(1 2 3)) will set x to the object #u8(1 2 3). Literal homogeneous vectors, like heterogeneous vectors, are self-evaluating; they do not need to be quoted. Homogeneous vectors can appear in quasiquotations but must not contain unquote or unquote-splicing forms (i.e. `(,x #u8(1 2)) is legal but `#u8(1 ,x 2) is not). This restriction is to accommodate the many Scheme systems that use the read procedure to parse programs.

Implementation

This implementation was developed on Chicken 5 and Chibi, and directly supports those two systems. There is support for Gauche as well. It should be easy to adapt to other implementations.

After downloading the source, it is necessary to run the atexpander.sh shell script in order to generate the individual files for the different types. This will take a skeleton file like at.sld and create the files u8.sld, s8.sld, ... c128.sld. The unexpander.sh script safely undoes the effects of atexpander.sh. The heavy lifting is done by sed.

Making this SRFI available on R6RS systems is straightforward, requiring only a replacement library file that includes the implementation files in the srfi/160/base directory and the srfi/160 directories. The file include.scm contains an R6RS (include) library that will be useful for systems that don't provide it.

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.

The implementation depends on SRFI 4. For systems that do not have a native SRFI 4 implementation, the version in the contrib/cowan directory of the SRFI 4 repository may be used; it depends only on a minimal implementation of bytevectors.

The tests are for the c64 and c128 procedures and the @? procedures only. The assumption is that tests for the underlying SRFI 4 procedures suffice for everything else.

The following files are provided:

The SRFI 160 libraries

The following files are provided:

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

Copyright

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

Contents »