chickadee » vector-lib » vector-copy

vector-copy vec #!optional start end fillprocedure

Allocates a new vector whose length is end - start and fills it with elements from vec, taking elements from vec starting at index start and stopping at index end. start defaults to 0 and end defaults to the value of (vector-length vec). If end extends beyond the length of vec, the slots in the new vector that obviously cannot be filled by elements from vec are filled with fill, whose default value is unspecified.


(vector-copy '#(a b c d e f g h i))
  ;=> #(a b c d e f g h i)
(vector-copy '#(a b c d e f g h i) 6)
  ;=> #(g h i)
(vector-copy '#(a b c d e f g h i) 3 6)
  ;=> #(d e f)
(vector-copy '#(a b c d e f g h i) 6 12 'x)
  ;=> #(g h i x x x)