sort
sort — sorts a list or array, destructively modifying the
order.
sort (list_or_array, compare_function)
list_or_arrayA list or an array.
compare_functionA function on two arguments used to compare elements in the list or array.
The input list or array,
sorted.
This function sorts the list or
array in place, destructively modifying the order
of the elements. The compare_function must be a
function on two arguments which returns: an integer value less than zero if
the first argument is ordinally less than the second, zero if the two
arguments are ordinally equal, and greater than zero if the first argument
is ordinally greater than the second. This function uses the quicksort
algorithm.
Gamma>x = list("one","two","three","four","five");("one" "two" "three" "four" "five")Gamma>sort(x,strcmp);("five" "four" "one" "three" "two")Gamma>x;("five" "four" "one" "three" "two")Gamma>