*** cl.texi.~1.31.~ 2006-12-26 11:20:21.000000000 +1100 --- cl.texi 2006-12-26 11:24:08.000000000 +1100 *************** *** 4082,4100 **** This function differs from Emacs' built-in @code{sort} in that it can operate on any type of sequence, not just lists. Also, it ! accepts a @code{:key} argument which is used to preprocess data ! fed to the @var{predicate} function. For example, @example ! (setq data (sort* data 'string-lessp :key 'downcase)) @end example @noindent ! sorts @var{data}, a sequence of strings, into increasing alphabetical ! order without regard to case. A @code{:key} function of @code{car} ! would be useful for sorting association lists. It should only be a ! simple accessor though, it's used heavily in the current ! implementation. The @code{sort*} function is destructive; it sorts lists by actually rearranging the @code{cdr} pointers in suitable fashion. --- 4082,4101 ---- This function differs from Emacs' built-in @code{sort} in that it can operate on any type of sequence, not just lists. Also, it ! accepts a @code{:key} argument which is used to access part of an ! element for the @var{predicate} function. For example, to sort ! structures by a particular field (@pxref{Structures}) @example ! (defstruct person name age sex) ! ! (setq data (sort* data 'string-lessp :key 'person-name)) @end example @noindent ! Or @code{car} would be useful for sorting association lists. The ! @code{:key} function is designed only as a data accessor though, it's ! used on every predicate call. The @code{sort*} function is destructive; it sorts lists by actually rearranging the @code{cdr} pointers in suitable fashion.