bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#69709: `sort` interface improvement and universal ordering predicate


From: Eli Zaretskii
Subject: bug#69709: `sort` interface improvement and universal ordering predicate
Date: Sun, 10 Mar 2024 16:09:32 +0200

> From: Mattias Engdegård <mattias.engdegard@gmail.com>
> Date: Sun, 10 Mar 2024 14:28:02 +0100
> 
> The proposed sorting function interface would be
> 
>   (new-sort seq &key key lessp destructive)

A nit: let's go with a name that doesn't have "new" as part of it.
Something like "lsort" or "xsort" or somesuch.  (I don't suggest
"nsort" because 'n' as the first character has a special meaning in
Emacs Lisp, so I'd like to avoid confusion.)

> because the keyword interface is easier to read and write than a lengthening 
> list of optional positional parameters, and can be extended more gracefully. 
> For example, it could be handy to have a `reversed` (or `descending`) 
> parameter. The parsing cost is not significant.
> 
> Instead of inventing a new and rather meaningless function name, I suggest we 
> re-use `sort` and allow both
> 
>   (sort seq lessp)                       ; old-style
>   (sort seq &key key lessp destructive)  ; new-style
> 
> since they are easy to distinguish, and let `destructive` default to false in 
> new-style calls, true in the old style.

Do you intend to present an implementation that replaces sort-on as
well?

And what about performance?

Thanks.





reply via email to

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