sort — Sort list using an expression
list
sort
( | any x , |
any y , | |
list LIST , | |
block
EXPR
) ; |
Sorts the list LIST
. You have to specify an order on the list elements by naming formal variables x
and y
and specify an expression EXPR
that evaluates to a boolean value depending on x
and y
. Return true if x
>y
to sort the list ascending.
The comparison must be an irreflexive one, that is ">" instead of ">=".
It is because we no longer use bubblesort (yuck) but std::sort which requires a <ulink url="href="http://www.sgi.com/tech/stl/StrictWeakOrdering.html">strict weak ordering</ulink>.