| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
A vector is a simple 1-dimensional array of Scheme objects. You can access its element by index in constant time. Once created, a vector can't be resized.
Class <vector> inherits <sequence> and
you can use various generic functions such as map and fold
on it. See section gauche.collection - Collection framework, and See section gauche.sequence - Sequence framework.
If you keep only a homogeneous numeric type, you may be able
to use SRFI-4 homogeneous vectors (See section srfi-4 - Homogeneous vectors).
See section srfi-43 - Vector library, for additional operations on vectors.
[R5RS]
Returns #t if obj is a vector, #f otherwise.
[R5RS] Creates and returns a vector with length k. If optional argument fill is given, each element of the vector is initialized by it. Otherwise, the initial value of each element is undefined.
[R5RS] Creates a vector whose elements are obj ….
[R5RS] Returns the length of a vector vector.
With gauche.collection module,
you can also use a method size-of.
[R5RS+] Returns k-th element of vector vector.
By default, vector-ref signals an error if k is
negative, or greater than or equal to the length of vector.
However, if an optional argument fallback is given,
it is returned for such case. This is an extension of Gauche.
With gauche.sequence module,
you can also use a method ref.
[R5RS] Sets k-th element of the vector vector to obj. It is an error if k is negative or greater than or equal to the length of vector.
With gauche.sequence module, you can also use
a setter method of ref.
[R5RS+][SRFI-43+] Converts a vector to a list, or vice versa.
The optional start and end arguments limit the range of the source.
(vector->list '#(1 2 3 4 5)) ⇒ (1 2 3 4 5) (list->vector '(1 2 3 4 5)) ⇒ #(1 2 3 4 5) (vector->list '#(1 2 3 4 5) 2 4) ⇒ (3 4) (list->vector (circular-list 'a 'b 'c) 1 6) ⇒ #(b c a b c) |
With gauche.collection module, you can use
(coerce-to <list> vector) and
(coerce-to <vector> list) as well.
[R5RS+][SRFI-43] Sets all elements in a vector vector to fill.
Optional start and end limits the range of effect between start-th index (inclusive) to end-th index (exclusive). Start defaults to zero, and end defaults to the length of vector. These optional arguments are Gauche's extension.
[SRFI-43] Copies a vector vector. Optional start and end arguments can be used to limit the range of vector to be copied. If the range specified by start and end falls outside of the original vector, the fill value is used to fill the result vector.
(vector-copy '#(1 2 3 4 5)) ⇒ #(1 2 3 4 5) (vector-copy '#(1 2 3 4 5) 2 4) ⇒ #(3 4) (vector-copy '#(1 2 3 4 5) 3 7 #f) ⇒ #(4 5 #f #f) |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] |
This document was generated by Shiro Kawai on October, 7 2008 using texi2html 1.78.