Function: -sort

-sort is a byte-compiled function defined in dash.el.

Signature

(-sort COMPARATOR LIST)

Documentation

Sort LIST, stably, comparing elements using COMPARATOR.

Return the sorted list. LIST is NOT modified by side effects. COMPARATOR is called with two elements of LIST, and should return non-nil if the first element should sort before the second.

View in manual

Source Code

;; Defined in ~/.emacs.d/elpa/dash-20260221.1346/dash.el
(defun -sort (comparator list)
  "Sort LIST, stably, comparing elements using COMPARATOR.
Return the sorted list.  LIST is NOT modified by side effects.
COMPARATOR is called with two elements of LIST, and should return non-nil
if the first element should sort before the second."
  (declare (important-return-value t))
  (static-if (condition-case nil (sort []) (wrong-number-of-arguments))
      ;; Since Emacs 30.
      (sort list :lessp comparator)
    (sort (copy-sequence list) comparator)))