On this page:
mutable-vector?
into-vector
into-mutable-vector
sequence->vector
7.7

4.4 Vectors

 (require rebellion/collection/vector)
  package: rebellion

procedure

(mutable-vector? v)  boolean?

  v : any/c
A predicate for mutable vectors. Implies vector?.

procedure

(into-vector [#:size size])  (reducer/c any/c immutable-vector?)

  size : (or/c natural? +inf.0) = +inf.0
Constructs a reducer that collects at most size elements of a sequence into an immutable vector.

Example:
> (transduce (in-naturals)
             (filtering odd?)
             #:into (into-vector #:size 5))

'#(1 3 5 7 9)

procedure

(into-mutable-vector [#:size size])

  (reducer/c any/c mutable-vector?)
  size : (or/c natural? +inf.0) = +inf.0
Constructs a reducer that collects at most size elements of a sequence into a mutable vector.

Example:
> (transduce (in-naturals)
             (filtering even?)
             #:into (into-mutable-vector #:size 5))

'#(0 2 4 6 8)

procedure

(sequence->vector seq)  immutable-vector?

  seq : (sequence/c any/c)
Copies seq into an immutable vector. If seq is already an immutable vector, it is returned directly.

Examples:
> (sequence->vector (list 1 2 3))

'#(1 2 3)

> (sequence->vector (in-range 0 10))

'#(0 1 2 3 4 5 6 7 8 9)