####
make-sorting-description

#####
Summary

Makes a sort description suitable for use in a sorted-object.

#####
Signature

make-sorting-description &key *
type*
*
key*
*
sort*
*
reverse-sort*

*
sort-function*
=> *
sorting-description*

#####
Arguments

*
type*

A Lisp object naming the type of sorting.

*
key*

A function of one argument.

*
sort*

A function of two arguments.

*
reverse-sort*

A function of two arguments.

*
sort-function*

A sorting function.

#####
Description

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

sort-function *
items*
*
predicate*
&key *
key*

The default value of *
sort-function*
is ```
sort
```

.

#####
Example

(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)

LispWorks CAPI Reference Manual - 11 Apr 2005