From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#69709: `sort` interface improvement and universal ordering predicate Date: Sun, 10 Mar 2024 16:09:32 +0200 Message-ID: <86zfv6uqjn.fsf@gnu.org> References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="31151"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 69709@debbugs.gnu.org To: Mattias =?UTF-8?Q?Engdeg=C3=A5rd?= , Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Mar 10 15:12:52 2024 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1rjJv1-0007tj-U1 for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 10 Mar 2024 15:12:52 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rjJuh-0000TK-P4; Sun, 10 Mar 2024 10:12:31 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rjJug-0000St-39 for bug-gnu-emacs@gnu.org; Sun, 10 Mar 2024 10:12:30 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rjJuf-0004eE-RT for bug-gnu-emacs@gnu.org; Sun, 10 Mar 2024 10:12:29 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rjJvC-00083Y-I7 for bug-gnu-emacs@gnu.org; Sun, 10 Mar 2024 10:13:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 10 Mar 2024 14:13:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 69709 X-GNU-PR-Package: emacs Original-Received: via spool by 69709-submit@debbugs.gnu.org id=B69709.171007994730928 (code B ref 69709); Sun, 10 Mar 2024 14:13:02 +0000 Original-Received: (at 69709) by debbugs.gnu.org; 10 Mar 2024 14:12:27 +0000 Original-Received: from localhost ([127.0.0.1]:37669 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rjJud-00082k-CP for submit@debbugs.gnu.org; Sun, 10 Mar 2024 10:12:27 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:59002) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rjJub-00082Y-Op for 69709@debbugs.gnu.org; Sun, 10 Mar 2024 10:12:26 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rjJrt-00049v-00; Sun, 10 Mar 2024 10:09:37 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=fvNdWHztwTOUoTmH2K0h3TuAaItV2eDbLcNprdHZzNE=; b=OWpdBjNy07vYJQA+VnOc PSLy/wUr9XNRzcOPt8soCRPcjoZ7x2aETqILNHVWs2KCHSdoH3S9w6gOWZNpyqCWtghmlzF8zcOjl bwdscQl8cWGUZLGNok3cpeqAWOhnNvSTaF6hesVUCgb2ilo5quoR0ulgBADF+qM8GIqsYp4SD8DsO MYI6Dtx2pGAMxZKIZq2sEsHvTKwXNt3ZC6BFb1gKLoOh2XrkVDYLHEOxs1SwivAO1hNccmeV4greU HjVUo5g/2BBxR1wqsz8+squMTHrh+UAaYuV/Uli5zT0FVdlcISGxQYmaRI2VM2wqWSxzsutvPEYry RvYl6NcJad3KTQ==; In-Reply-To: (message from Mattias =?UTF-8?Q?Engdeg=C3=A5rd?= on Sun, 10 Mar 2024 14:28:02 +0100) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:281396 Archived-At: > From: Mattias EngdegÄrd > 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.