aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
authorMattias EngdegÄrd2024-03-22 15:06:27 +0100
committerMattias EngdegÄrd2024-03-23 14:18:57 +0100
commited59a2639a9dd4927d0424f292b1ba30f65bb8bb (patch)
treefb272d09ea66ed3f8c0f29e039e6bd028062d129 /lisp
parent592ca5070e209dc293ad3be2348dfef801bf0ed1 (diff)
downloademacs-scratch/sort-key.tar.gz
emacs-scratch/sort-key.zip
Remove sort-onscratch/sort-key
* lisp/sort.el (sort-on): * doc/lispref/sequences.texi (Sequence Functions): * etc/NEWS: Remove the `sort-on` function which is now completely superseded by the extended `sort` in features, ease of use, and performance.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/sort.el21
1 files changed, 0 insertions, 21 deletions
diff --git a/lisp/sort.el b/lisp/sort.el
index 4f0d759ef8a..2ee76b6e1e3 100644
--- a/lisp/sort.el
+++ b/lisp/sort.el
@@ -478,27 +478,6 @@ sRegexp specifying key within record: \nr")
478 ;; if there was no such register 478 ;; if there was no such register
479 (error (throw 'key nil)))))))))) 479 (error (throw 'key nil))))))))))
480 480
481;;;###autoload
482(defun sort-on (sequence predicate accessor)
483 "Sort SEQUENCE by calling PREDICATE on sort keys produced by ACCESSOR.
484SEQUENCE should be the input sequence to sort.
485Elements of SEQUENCE are sorted by keys which are obtained by
486calling ACCESSOR on each element. ACCESSOR should be a function of
487one argument, an element of SEQUENCE, and should return the key
488value to be compared by PREDICATE for sorting the element.
489PREDICATE is the function for comparing keys; it is called with two
490arguments, the keys to compare, and should return non-nil if the
491first key should sort before the second key.
492The return value is always a new list.
493This function has the performance advantage of evaluating
494ACCESSOR only once for each element in the input SEQUENCE, and is
495therefore appropriate when computing the key by ACCESSOR is an
496expensive operation. This is known as the \"decorate-sort-undecorate\"
497paradigm, or the Schwartzian transform."
498 (mapcar #'car
499 (sort (mapcar #'(lambda (x) (cons x (funcall accessor x))) sequence)
500 #'(lambda (x y) (funcall predicate (cdr x) (cdr y))))))
501
502 481
503(defvar sort-columns-subprocess t) 482(defvar sort-columns-subprocess t)
504 483