Makes a sort description suitable for use in a sorted-object.
make-sorting-description &key
type
key
sort
reverse-sort
sort-function
=>
sorting-description
A Lisp object naming the type of sorting.
A function of one argument.
A function of two arguments.
A function of two arguments.
A sorting function.
The function
make-sorting-description
makes a sort description object that can be used as one of the
sort-descriptions
in a sorted-object such as a list-panel.
type is a name that should be unique amongst the sort-descriptions of a sorted-object.
key
is a function that is passed to
sort-function
as its
:key
argument. The default value of
key
is
identity
.
sort is a predicate function that is passed to sort-function to compare pairs of items.
reverse-sort is a predicate function that is passed to sort-function for reverse sorting.
sort-function is the function that is called to actually do the sorting. Its signature is
(setq lp
(capi:contain
(make-instance
'capi:list-panel
:items '("Apple"
"Orange"
"Mangosteen"
"Pineapple")
:visible-min-height '(:character 5)
:sort-descriptions
(list (capi:make-sorting-description
:type :length
:sort
#'(lambda (x y)
(> (length x) (length y)))
:reverse-sort
#'(lambda (x y)
(< (length x) (length y))))
(capi:make-sorting-description
:type :alphabetic
:sort 'string-greaterp
:reverse-sort 'string-lessp)))))
(capi:sorted-object-sort-by lp :length)
(capi:sorted-object-sort-by lp :alphabetic)