### 8.1 Construction of Vectors

procedure: make-vector k [object]

  Returns a newly allocated vector of k elements. If object is specified, `make-vector` initializes each element of the vector to object. Otherwise the initial elements of the result are unspecified.

procedure: vector object …

  Returns a newly allocated vector whose elements are the given arguments. `vector` is analogous to `list`.

      (vector 'a 'b 'c)                       ⇒  #(a b c)

procedure: vector-copy vector

  Returns a newly allocated vector that is a copy of vector.

procedure: list->vector list

  Returns a newly allocated vector initialized to the elements of list. The inverse of `list->vector` is `vector->list`.

      (list->vector '(dididit dah))           ⇒  #(dididit dah)

standard procedure: string->vector string [start [end]]
standard procedure: vector->string vector [start [end]]

  It is an error if any element of vector is not a character.

  The `vector->string` procedure returns a newly allocated string of the objects contained in the elements of vector between start and end. The `string->vector` procedure returns a newly created vector initialized to the elements of the string string between start and end.

  In both procedures, order is preserved.

      (string->vector "ABC")                  ⇒  #(#\A #\B #\C)
      (vector->string #(#\1 #\2 #\3)          ⇒  "123"

procedure: make-initialized-vector k initialization

  Similar to `make-vector`, except that the elements of the result are determined by calling the procedure initialization on the indices. For example:

      (make-initialized-vector 5 (lambda (x) (* x x)))
           ⇒  #(0 1 4 9 16)

procedure: vector-grow vector k

  K must be greater than or equal to the length of vector. Returns a newly allocated vector of length k. The first `(vector-length vector)` elements of the result are initialized from the corresponding elements of vector. The remaining elements of the result are unspecified.

procedure: vector-map procedure vector

  Procedure must be a procedure of one argument. `vector-map` applies procedure element-wise to the elements of vector and returns a newly allocated vector of the results, in order from left to right. The dynamic order in which procedure is applied to the elements of vector is unspecified.

      (vector-map cadr '#((a b) (d e) (g h)))     ⇒  #(b e h)
      (vector-map (lambda (n) (expt n n)) '#(1 2 3 4))
                                                  ⇒  #(1 4 27 256)
      (vector-map + '#(5 7 9))                    ⇒  #(5 7 9)