| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
gauche.uvector - Uniform vectors Gauche's implementation is a superset of SRFI-4 in a few ways:
TAGvector->list
takes optional start and end indices, and TAGvector-ref
takes optional fallback value.
TAGvector-copy and
TAGvector-copy!), conversion procedures
(TAGvector->vector and vector->TAGvector),
and some arithmetic functions (TAGvector-add, etc.)
gauche.collection - Collection framework)
and the sequence framework (See section 9.18 gauche.sequence - Sequence framework). So the
methods like map, for-each, ref or subseq
can be used on the SRFI-4 vector types.
There are some advantages of using SRFI-4 vectors over normal (heterogeneous) vectors. It may be more compact than the normal vectors. Some operations (especially Gauche's extension of vector arithmetic operations) can bypass type check and conversion of individual elements, thus be more efficient. And it is much easier and efficient to communicate with external libraries that require homogeneous array of numbers; for example, OpenGL binding of Gauche uses SRFI-4 vectors extensively.
float of
C compiler that compiles Gauche. Usually it is a single precision
IEEE floating point number.
double of
C compiler that compiles Gauche. Usually it is a double precision
IEEE floating point number.
When you try to store a number out of the range of the vector type, an error is signalled by default. However, some procedures take an optional argument clamp that specifies alternative behavior in such a case. Clamp argument may take one of the following values.
#f
high
low
both
high and low.
(list->u8vector '(-1)) => error (list->u8vector '(-1) 'low) => #u8(0) (list->u8vector '(-1) 'high) => error (list->u8vector '(3000) 'high) => #u8(255) (list->u8vector '(-100 20 300) 'both) => #u8(0 20 255) |
In the following description, TAG can be replaced
for any of s8, u8, s16, u16,
s32, u32, s64, u64, f32, f64.
9.24.1 Uvector basic operations 9.24.2 Uvector conversion operations 9.24.3 Uvector numeric operations 9.24.4 Uvector block I/O
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |