Kawa, the Java-based Scheme system

Node:Uniform vectors, Next:Exceptions, Previous:Arrays, Up:Extensions

### Uniform vectors

Uniform vectors are vectors whose elements are of the same numeric type. The are defined by SRFI-4. However, the type names (such as `<s8vector>`) are a Kawa extension.

<s8vector> | Variable

The type of uniform vectors where each element can contain a signed 8-bit integer. Represented using an array of `<byte>`.

<u8vector> | Variable

The type of uniform vectors where each element can contain an unsigned 8-bit integer. Represented using an array of `<byte>`, but each element is treated as if unsigned.

<s16vector> | Variable

The type of uniform vectors where each element can contain a signed 16-bit integer. Represented using an array of `<short>`.

<u16vector> | Variable

The type of uniform vectors where each element can contain an unsigned 16-bit integer. Represented using an array of `<short>`, but each element is treated as if unsigned.

<s32vector> | Variable

The type of uniform vectors where each element can contain a signed 32-bit integer. Represented using an array of `<int>`.

<u32vector> | Variable

The type of uniform vectors where each element can contain an unsigned 32-bit integer. Represented using an array of `<int>`, but each element is treated as if unsigned.

<s64vector> | Variable

The type of uniform vectors where each element can contain a signed 64-bit integer. Represented using an array of `<long>`.

<u64vector> | Variable

The type of uniform vectors where each element can contain an unsigned 64-bit integer. Represented using an array of `<long>`, but each element is treated as if unsigned.

<f32vector> | Variable

The type of uniform vectors where each element can contain a 32-bit floating-point real. Represented using an array of `<float>`.

<f64vector> | Variable

The type of uniform vectors where each element can contain a 64-bit floating-point real. Represented using an array of `<double>`.

s8vector? value | Function
u8vector? value | Function
s16vector? value | Function
u16vector? value | Function
s32vector? value | Function
u32vector? value | Function
s64vector? value | Function
u64vector? value | Function
f32vector? value | Function
f64vector? value | Function

Return true iff value is a uniform vector of the specified type.

make-s8vector n [value] | Function
make-u8vector n [value] | Function
make-s16vector n [value] | Function
make-u16vector n [value] | Function
make-s32vector n [value] | Function
make-u32vector n [value] | Function
make-s64vector n [value] | Function
make-u64vector n [value] | Function
make-f32vector n [value] | Function
make-f64vector n [value] | Function

Create a new uniform vector of the specified type, having room for n elements. Initialize each element to value if it is specified; zero otherwise.

s8vector value ... | Function
u8vector value ... | Function
s16vector value .. | Function
u16vector value ... | Function
s32vector value ... | Function
u32vector value ... | Function
s64vector value ... | Function
u64vector value ... | Function
f32vector value ... | Function
f64vector value ... | Function

Create a new uniform vector of the specified type, whose length is the number of values specified, and initialize it using those values.

s8vector-length v | Function
u8vector-length v | Function
s16vector-length v | Function
u16vector-length v | Function
s32vector-length v | Function
u32vector-length v | Function
s64vector-length v | Function
u64vector-length v | Function
f32vector-length v | Function
f64vector-length v | Function

Return the length (in number of elements) of the uniform vector v.

s8vector-ref v i | Function
u8vector-ref v i | Function
s16vector-ref v i | Function
u16vector-ref v i | Function
s32vector-ref v i | Function
u32vector-ref v i | Function
s64vector-ref v i | Function
u64vector-ref v i | Function
f32vector-ref v i | Function
f64vector-ref v i | Function

Return the element at index i of the uniform vector v.

s8vector-set! v i x | Function
u8vector-set! v i x | Function
s16vector-set! v i x | Function
u16vector-set! v i x | Function
s32vector-set! v i x | Function
u32vector-set! v i x | Function
s64vector-set! v i x | Function
u64vector-set! v i x | Function
f32vector-set! v i x | Function
f64vector-set! v i x | Function

Set the element at index i of uniform vector v to the value x, which must be a number coercible to the appropriate type.

s8vector->list v | Function
u8vector->list v | Function
s16vector->list v | Function
u16vector->list v | Function
s32vector->list v | Function
u32vector->list v | Function
s64vector->list v | Function
u64vector->list v | Function
f32vector->list v | Function
f64vector->list v | Function

Convert the uniform vetor v to a list containing the elments of v.

list->s8vector l | Function
list->u8vector l | Function
list->s16vector l | Function
list->u16vector l | Function
list->s32vector l | Function
list->u32vector l | Function
list->s64vector l | Function
list->u64vector l | Function
list->f32vector l | Function
list->f64vector l | Function

Create a uniform vector of the appropriate type, initializing it with the elements of the list l. The elements of l must be numbers coercible the new vector's element type.