vectorsort!  (possibly unstable) sorting of vectors
LIBRARY
(import (rnrs)) ;R6RS
(import (rnrs sorting)) ;R6RS
SYNOPSIS
(vectorsort! proc vector)
DESCRIPTION
Destructively sorts
vector
in ascending order according to
proc.
The procedure
proc
should accept two elements and return a true value when its first
argument is strictly less than its second, and
#f
otherwise.
The sorting algorithm may be unstable. This means that two elements
which are equal according to
proc
but not according to
eq?(3scm)
may change order.
 Time complexity

The sorting algorithm performs O(n²) calls to
proc
where n is the length of
vector.
 Unspecified order and side effects

The pairing of arguments and the sequencing of calls to
proc
are not specified.
The procedure
proc
should not have any side effects.
IMPLEMENTATION NOTES
Most practical sorting algorithms may be used, with Quicksort and
merge sort being common choices.
RETURN VALUES
This procedure returns unspecified values.
EXAMPLES
(define v (vector 3 5 2 1))
(vectorsort! < v) => unspecified
v => #(1 2 3 5)
RATIONALE
The requirements placed on this procedure are less strict so that
simple inplace algorithms like Quicksort can be used.
COMPATIBILITY
These procedures are unique to R6RS. Alternatives are available in
SRFI95 and SRFI132.
ERRORS
This procedure can raise exceptions with the following condition types:
 &assertion (R6RS)

The wrong number of arguments was passed or an argument was outside its domain.
In particular,
proc
should accept two arguments, which are elements from
list
or
vector,
and return one value.
SEE ALSO
listsort(3scm)
STANDARDS
R6RS
HISTORY
This procedure first appeared in R6RS.
AUTHORS
This page is part of the
schememanpages
project.
It includes materials from the RnRS documents.
More information can be found at
https://github.com/schemedoc/manpages/
.
Markup created by unroff 1.0sc, March 04, 2023.