manpagez: man pages & more
info bigloo
Home | html | info | man
[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

6.1.11 Vectors

Vectors are not autoquoted objects.

procedure: vector? obj
procedure: make-vector k
procedure: make-vector k obj
library procedure: vector obj …
procedure: vector-length vector
procedure: vector-ref vector k
procedure: vector-set! vector k obj
library procedure: vector->list vector
library procedure: list->vector list
library procedure: vector-fill! vector obj

Stores obj in every element of vector. For instance:

(let ((v (make-vector 5 #f)))
   (vector-fill! v #t)
   v)
bigloo procedure: copy-vector vector len

Allocate a new vector of size len and fills it with the first len element of vector. The new length len may be bigger than the old vector length.

bigloo procedure: vector-copy vector start end

vector must be a vector, and start and end must be exact integers satisfying:

  0 <= START <= END <= (vector-length VECTOR)

vector-copy returns a newly allocated vector formed from the elements of VECTOR beginning with index START (inclusive) and ending with index END (exclusive).

(vector-copy '#(1 2 3 4) 0 4)
   ⇒ '#(1 2 3 4)
(vector-copy '#(1 2 3 4) 1 3)
   ⇒ '#(2 3)
bigloo procedure: vector-copy! target tstart source [sstart [send]]

Copies a block of elements from source to target, both of which must be vectors, starting in target at tstart and starting in source at sstart, ending when send - sstart elements have been copied. It is an error for target to have a length less than tstart + (send - sstart). Sstart defaults to 0 and send defaults to the length of source.

See section r5rs.info, for more details.

bigloo procedure: vector-append vector …

Returns a newly allocated vector that contains all elements in order from the subsequent locations in vector ….

Examples:

(vector-append '#(x) '#(y)) ⇒ #(x y)
(vector-append '#(a) '#(b c d)) ⇒ #(a b c d)
(vector-append '#(a #(b)) '#(#(c))) ⇒ #(a #(b) #(c))
bigloo procedure: vector-map proc vector …
bigloo procedure: vector-map! proc vector …

The function vector-map creates a new vector whose size the is the size of its argument vector. Each elements of the new vector is the result of apply proc to the corresponding elements of the initial vectors.

The function vector-map! modifies the elements of the argument vector.


[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

This document was generated on March 31, 2014 using texi2html 5.0.

© manpagez.com 2000-2024
Individual documents may contain additional copyright information.