Previous: Cutting Vectors, Up: Vectors
Stores object in every element of the vector (subvector) and returns an unspecified value.
Destructively copies the elements of vector1, starting with index start1 (inclusive) and ending with end1 (exclusive), into vector2 starting at index start2 (inclusive). Vector1, start1, and end1 must specify a valid subvector, and start2 must be a valid index for vector2. The length of the source subvector must not exceed the length of vector2 minus the index start2.
The elements are copied as follows (note that this is only important when vector1 and vector2 are
eqv?
):
subvector-move-left!
- The copy starts at the left end and moves toward the right (from smaller indices to larger). Thus if vector1 and vector2 are 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 vector1 and vector2 are the same, this procedure moves the elements toward the right inside the vector.
Procedure must be a procedure of two arguments that defines a total ordering on the elements of vector. The elements of vector are rearranged so that they are sorted in the order defined by procedure. The elements are rearranged in place, that is, vector is destructively modified so that its elements are in the new order.
sort!
returns vector as its value.Two sorting algorithms are implemented:
merge-sort!
andquick-sort!
. The proceduresort!
is an alias formerge-sort!
.See also the definition of
sort
.