Function: seq-sort

seq-sort is a byte-compiled function defined in seq.el.gz.

Signature

(seq-sort PRED SEQUENCE)

Documentation

Sort SEQUENCE using PRED as the sorting comparison function.

The result is a sequence of the same type as SEQUENCE. The sort operates on a copy of SEQUENCE and does not modify SEQUENCE.

Other relevant functions are documented in the sequence group.

View in manual

Shortdoc

;; sequence
(seq-sort #'> '(1 2 3))
    => (3 2 1)

Implementations

(seq-sort PRED (LIST list)) in `seq.el'.

Undocumented

(seq-sort PRED SEQUENCE) in `seq.el'.

Undocumented

Source Code

;; Defined in /usr/src/emacs/lisp/emacs-lisp/seq.el.gz
(cl-defgeneric seq-sort (pred sequence)
  "Sort SEQUENCE using PRED as the sorting comparison function.
The result is a sequence of the same type as SEQUENCE.  The sort
operates on a copy of SEQUENCE and does not modify SEQUENCE."
  (let ((result (seq-sort pred (append sequence nil))))
    (seq-into result (type-of sequence))))