Function: cl-sort
cl-sort is an autoloaded and byte-compiled function defined in
cl-seq.el.gz.
Signature
(cl-sort SEQ PREDICATE [KEYWORD VALUE]...)
Documentation
Sort the argument SEQ according to PREDICATE.
This is a destructive function; it reuses the storage of SEQ if possible.
Keywords supported: :key
Aliases
sort* (obsolete since 27.1)
Source Code
;; Defined in /usr/src/emacs/lisp/emacs-lisp/cl-seq.el.gz
;;;###autoload
(defun cl-sort (cl-seq cl-pred &rest cl-keys)
"Sort the argument SEQ according to PREDICATE.
This is a destructive function; it reuses the storage of SEQ if possible.
\nKeywords supported: :key
\n(fn SEQ PREDICATE [KEYWORD VALUE]...)"
(if (nlistp cl-seq)
(cl-replace cl-seq (apply 'cl-sort (append cl-seq nil) cl-pred cl-keys))
(cl--parsing-keywords (:key) ()
(if (memq cl-key '(nil identity))
(sort cl-seq cl-pred)
(sort cl-seq (lambda (cl-x cl-y)
(funcall cl-pred (funcall cl-key cl-x)
(funcall cl-key cl-y))))))))