diff options
| author | Mattias EngdegÄrd | 2024-03-22 15:06:27 +0100 |
|---|---|---|
| committer | Mattias EngdegÄrd | 2024-03-23 14:18:57 +0100 |
| commit | ed59a2639a9dd4927d0424f292b1ba30f65bb8bb (patch) | |
| tree | fb272d09ea66ed3f8c0f29e039e6bd028062d129 /lisp | |
| parent | 592ca5070e209dc293ad3be2348dfef801bf0ed1 (diff) | |
| download | emacs-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.el | 21 |
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. | ||
| 484 | SEQUENCE should be the input sequence to sort. | ||
| 485 | Elements of SEQUENCE are sorted by keys which are obtained by | ||
| 486 | calling ACCESSOR on each element. ACCESSOR should be a function of | ||
| 487 | one argument, an element of SEQUENCE, and should return the key | ||
| 488 | value to be compared by PREDICATE for sorting the element. | ||
| 489 | PREDICATE is the function for comparing keys; it is called with two | ||
| 490 | arguments, the keys to compare, and should return non-nil if the | ||
| 491 | first key should sort before the second key. | ||
| 492 | The return value is always a new list. | ||
| 493 | This function has the performance advantage of evaluating | ||
| 494 | ACCESSOR only once for each element in the input SEQUENCE, and is | ||
| 495 | therefore appropriate when computing the key by ACCESSOR is an | ||
| 496 | expensive operation. This is known as the \"decorate-sort-undecorate\" | ||
| 497 | paradigm, 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 | ||