next up previous contents index
Next: split! Up: ListType Previous: setRest!   Contents   Index


sort!


Usage

sort! l
sort!(l, f)


Signature

sort!: (%,(T,T) $\to$ Boolean) $\to$ %


Parameter Type Description
l % a list
f (T, T) $\to$ Boolean a comparison function


Description

Sorts the list $a$ using the ordering $x < y \iff f(x,y)$. The comparison function $f$ is optional if $T$ has TotallyOrderedType, in which case the order function of $T$ is taken.


Remarks

sort! does not make a copy of $l$, which is therefore modified after the call. It is unsafe to use the variable $l$ after the call, unless it has been assigned to the result of the call, as in l := sort! l.


See Also

merge!



Manuel Bronstein 2004-06-28