Function: seq-sort-by

seq-sort-by is an autoloaded and byte-compiled function defined in seq-25.el.

Signature

(seq-sort-by FUNCTION PRED SEQUENCE)

Documentation

Sort SEQUENCE transformed by FUNCTION using PRED as the comparison function.

Elements of SEQUENCE are transformed by FUNCTION before being sorted. FUNCTION must be a function of one argument.

Other relevant functions are documented in the sequence group.

Shortdoc

;; sequence
(seq-sort-by (lambda (a) (/ 1.0 a)) #'< '(1 2 3))
    => (3 2 1)

Source Code

;; Defined in ~/.emacs.d/elpa/seq-2.24/seq-25.el
;;;###autoload
(defun seq-sort-by (function pred sequence)
  "Sort SEQUENCE transformed by FUNCTION using PRED as the comparison function.
Elements of SEQUENCE are transformed by FUNCTION before being
sorted.  FUNCTION must be a function of one argument."
  (seq-sort (lambda (a b)
              (funcall pred
                       (funcall function a)
                       (funcall function b)))
            sequence))