![]() | ![]() | ![]() | stable-sortf | ![]() |
| place predicate
&key key | [Macro] |
Purpose
Stably sort the sequence value of place, and change the value of
place to the sorted result.
Package :gbbopen-tools
Module :gbbopen-tools
Arguments and values
place | A form which is suitable for use as a generalized reference | |
predicate | A function designator specifying a function object of two arguments that returns a generalized boolean | |
key | A function designator specifying a function object
of one argument, or nil (default is nil )
|
Description
The first argument to the predicate function is one element of the
sequence value in place (or part of that element extracted by the key
function, if supplied); the second argument another element of the sequence
(or part of that element extracted by the key function, if
supplied). The predicate function should return true if and only if
the first argument is strictly less than the second; otherwise the predicate
should return false.
The sorting operation can be destructive. Elements considered equal by predicate stay in their original order.
See also
sortf
Example
> (defparameter *x* '(1 2 3 6 5 4)) *x* > (stable-sortf *x* #'(lambda (x y) (and (oddp x) (evenp y)))) (1 3 5 2 6 4) > *x* (1 3 5 2 6 4) >
The GBBopen Project
![]() | ![]() | ![]() | stable-sortf | ![]() |