Status: complete, though doesn't entirely detail the underlying implementation, since a great deal of this is mostly introductory Computer Science stuff.
Description: contains functions for sorting lists and `normal' vectors.
Note: for each argument named less?, this refers to a
procedure of two arguments, which returns #t if the first
argument is less than the second argument, else returns #f
Note: most of the documentation is from the `NEWS' file.
Note: we use both quicksort and mergesort, depending on
whether we want to be stable or not. Consult a good book on algorithms
if you have no idea what I mean.
#t when the sequence argument seq is in
non-decreasing order according to less? (that is, there is no
adjacent pair `... x y ...' for which `(less? y x)').
Returns #f when the sequence contains at least one out-of-order
pair. It is an error if the sequence is neither a list nor a vector.
Assume that the elements a and b1 in list1 and b2 in list2
are "equal" in the sense that (less? x y) --> #f for x,
y in {a, b1, b2}, and that a < b1 in list1. Then a < b1 < b2 in the
result. (Here "<" should read "comes before".)
(sorted? (sort sequence less?) less?)". The
original sequence is not altered in any way. The new sequence shares
its elements with the old one; no elements are copied.
(set! slist (sort!
slist <))
sort but stable. That is, if "equal" elements are
ordered a < b in the original sequence, they will have the same order in
the result.
sort! but stable. Uses temporary storage when sorting
vectors.