emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

scratch/sort-key 7250e610f51 08/11: Add NEWS entry for new `sort` argume


From: Mattias Engdegård
Subject: scratch/sort-key 7250e610f51 08/11: Add NEWS entry for new `sort` arguments and features
Date: Sat, 23 Mar 2024 09:19:35 -0400 (EDT)

branch: scratch/sort-key
commit 7250e610f5142c7f7e47547de46038b896eabbda
Author: Mattias Engdegård <mattiase@acm.org>
Commit: Mattias Engdegård <mattiase@acm.org>

    Add NEWS entry for new `sort` arguments and features
    
    * etc/NEWS: Announce the changes (bug#69709).
---
 etc/NEWS | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/etc/NEWS b/etc/NEWS
index a525d84e2f9..4a68737ba5f 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -1716,6 +1716,24 @@ bool-vectors, markers, buffers and processes.
 It is intended as a convenient ordering predicate for sorting, and is
 likely to be faster than hand-written Lisp functions.
 
+** New 'sort' arguments and features.
+The 'sort' function can now be called using the signature
+
+    (sort SEQ &rest KEYWORD-ARGUMENTS)
+
+where arguments after the first are keyword/value pairs, all optional:
+':key' specifies a function that produces the sorting key from an element,
+':lessp' specifies the ordering predicate, defaulting to 'value<',
+':reverse' is used to reverse the sorting order,
+':in-place is used for in-place sorting, as the default is now to
+sort a copy of the input.
+
+The new signature is less error-prone and reduces the need to write
+ordering predicates by hand.
+
+The old signature, '(sort SEQ PREDICATE)', can still be used and sorts
+its input in-place as before.
+
 ** New function 'sort-on'.
 This function implements the Schwartzian transform, and is appropriate
 for sorting lists when the computation of the sort key of a list



reply via email to

[Prev in Thread] Current Thread [Next in Thread]