chickadee » srfi-133 » vector-copy

vector-copy vec #!optional start endprocedure

[R7RS-small] 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). SRFI 43 provides an optional fill argument to supply values if end is greater than the length of vec. Neither R7RS-small nor this SRFI requires support for this argument.


(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)