Previous: Cutting Vectors, Up: Vectors

— procedure: **vector-fill!**` vector object`

— procedure:**subvector-fill!**` vector start end object`

— procedure:

Stores

objectin every element of the vector (subvector) and returns an unspecified value.

— procedure: **subvector-move-left!**` vector1 start1 end1 vector2 start2`

— procedure:**subvector-move-right!**` vector1 start1 end1 vector2 start2`

— procedure:

Destructively copies the elements of

vector1, starting with indexstart1(inclusive) and ending withend1(exclusive), intovector2starting at indexstart2(inclusive).Vector1,start1, andend1must specify a valid subvector, andstart2must be a valid index forvector2. The length of the source subvector must not exceed the length ofvector2minus the indexstart2.The elements are copied as follows (note that this is only important when

vector1andvector2are`eqv?`

):

`subvector-move-left!`

- The copy starts at the left end and moves toward the right (from smaller indices to larger). Thus if
vector1andvector2are the same, this procedure moves the elements toward the left inside the vector.`subvector-move-right!`

- The copy starts at the right end and moves toward the left (from larger indices to smaller). Thus if
vector1andvector2are the same, this procedure moves the elements toward the right inside the vector.

— procedure: **sort!**` vector procedure`

— procedure:**merge-sort!**` vector procedure`

— procedure:**quick-sort!**` vector procedure`

— procedure:

— procedure:

Proceduremust be a procedure of two arguments that defines a total ordering on the elements ofvector. The elements ofvectorare rearranged so that they are sorted in the order defined byprocedure. The elements are rearranged in place, that is,vectoris destructively modified so that its elements are in the new order.

`sort!`

returnsvectoras its value.Two sorting algorithms are implemented:

`merge-sort!`

and`quick-sort!`

. The procedure`sort!`

is an alias for`merge-sort!`

.See also the definition of

`sort`

.