From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Mattias =?UTF-8?Q?Engdeg=C3=A5rd?= Newsgroups: gmane.emacs.bugs Subject: bug#69709: `sort` interface improvement and universal ordering predicate Date: Wed, 20 Mar 2024 20:01:39 +0100 Message-ID: <8366111E-97C4-4839-AA1E-A577C81A6035@gmail.com> References: <86zfv6uqjn.fsf@gnu.org> <4391448A-C7AF-4D7F-8866-C0313956D52D@gmail.com> Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.120.0.1.15\)) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="25741"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 69709@debbugs.gnu.org, Gerd =?UTF-8?Q?M=C3=B6llmann?= , Stefan Monnier , Dmitry Gutov To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Mar 20 20:10:46 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 1rn1Ko-0006Ya-AP for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 20 Mar 2024 20:10:46 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rn1KS-00025G-L3; Wed, 20 Mar 2024 15:10:24 -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 1rn1KQ-00024d-PZ for bug-gnu-emacs@gnu.org; Wed, 20 Mar 2024 15:10:22 -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 1rn1KQ-0003Ep-Hd for bug-gnu-emacs@gnu.org; Wed, 20 Mar 2024 15:10:22 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rn1L4-00060g-11 for bug-gnu-emacs@gnu.org; Wed, 20 Mar 2024 15:11:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Mattias =?UTF-8?Q?Engdeg=C3=A5rd?= Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 20 Mar 2024 19:11:01 +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.171096182122966 (code B ref 69709); Wed, 20 Mar 2024 19:11:01 +0000 Original-Received: (at 69709) by debbugs.gnu.org; 20 Mar 2024 19:10:21 +0000 Original-Received: from localhost ([127.0.0.1]:57527 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rn1KP-0005yL-0A for submit@debbugs.gnu.org; Wed, 20 Mar 2024 15:10:21 -0400 Original-Received: from mail-lf1-f49.google.com ([209.85.167.49]:51496) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rn1Di-0005en-Nj for 69709@debbugs.gnu.org; Wed, 20 Mar 2024 15:03:27 -0400 Original-Received: by mail-lf1-f49.google.com with SMTP id 2adb3069b0e04-513dd2d2415so219920e87.3 for <69709@debbugs.gnu.org>; Wed, 20 Mar 2024 12:02:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1710961301; x=1711566101; darn=debbugs.gnu.org; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:sender:from:to:cc:subject :date:message-id:reply-to; bh=AknJvmix6OJON2lW2QnhuxlyOJE75z4Zy0IkLbAeoAM=; b=JrEwnpTbGjw3pd/np/4YXE5czx0FLfBP9i30xhNrYceUOQ2r1eYmAdMtfZPJYPDbWv v+6jmSl5W5UOOYHiYAR+6S/DfQJxnuCKo6NKrpCePKiwjUuyyO3cCVVA3A94WfRpB1Qy xYZPZWMLwMLT1PFUTucSUroZSexUqvs+tu1KAjt0p3bE7NbYiGd7ZtuOMNpKvwPb6iSm DsCirGGkkIfQG3IPx0FSZeVWNtMLYsWZg7jSVJtlQqZ82ny0BI5RALdS1M/GsZf6ObM5 Xo8nsmjjYdf13Zu4Drd9eXtOZqSu636o+j8qvGdcccr9Pir7PPa49mJcLPQP7P5gerCr L5bQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710961301; x=1711566101; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:sender:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=AknJvmix6OJON2lW2QnhuxlyOJE75z4Zy0IkLbAeoAM=; b=SlMXXdEo5Ku0CwaDm1ryyBblJ4hA3GmbzvfKCCxbS4yEKN1WpcvKvz9ZtixA7bQJPj 75491GHaS/4liohmWMKY8WziQhDPiGqI9GKUNl53oBBp2QeoK+MLKZ1bc6rOiBsJqCvA tQCkUO+yPCb0YGfM2MtUF0k1LmM8oXizEBcxPigejaHoF6q5ArApWuKKN7v1KxEzYAkn v73spqTLFPD785X0Et08N/JOf+6RJchBP07uqKDdAQWHk0tSp0FzeIJY5JWxMlSMPceT kpybfXAr4f3T19MEx6it8UdGP9sDdbrdxQefPZP+D+uq0Tw2aDbdiG2yhhRncdJt1BMh jNzA== X-Forwarded-Encrypted: i=1; AJvYcCX3mNnW7jPIxYvJ5wQb1e6XZkaRkjJY8SkjZLmn74tsqs28TU0EJMphJ/M1wKR4lgyJK6rSuMl3oycvmGKq9Of7jVnL37I= X-Gm-Message-State: AOJu0Yx2urzrKdYuheWyDvuVfIF6BTXOrpWQpDyGhqlkEEnhImAHPEme zfrOOQKBo8zd6Hu2cxHnY+AuZc1HWIhaIcncJhPW1A/Fa+SpOuBC X-Google-Smtp-Source: AGHT+IFReGZCWZ4lPqsCuLTwm7fpFPSZDMFcA2d711AUba4/HCpf//3Bo5RXVhCEtza68MB4o89HrA== X-Received: by 2002:ac2:5f9a:0:b0:513:5fb0:c5ad with SMTP id r26-20020ac25f9a000000b005135fb0c5admr12919841lfe.17.1710961300964; Wed, 20 Mar 2024 12:01:40 -0700 (PDT) Original-Received: from smtpclient.apple (c80-217-1-132.bredband.tele2.se. [80.217.1.132]) by smtp.gmail.com with ESMTPSA id c10-20020ac2530a000000b00513adadde59sm2343210lfh.294.2024.03.20.12.01.39 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 20 Mar 2024 12:01:40 -0700 (PDT) In-Reply-To: <4391448A-C7AF-4D7F-8866-C0313956D52D@gmail.com> X-Mailer: Apple Mail (2.3654.120.0.1.15) 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:281875 Archived-At: Now the origin/scratch/sort-key branch contains a draft proposal. = Summary: * Our timsort has now the key function handling from the original code = (ported to Emacs). * New keyword-based calling convention for `sort`. The old one is still = there and works as before. * New `value-less-p` universal ordering predicate. * No manual updates yet. * NEWS entries are there. * `sort-on` is now completely superfluous (slower, less convenient) and = should be removed. * Performance seems fine from initial tests. More comprehensive = benchmarking will be done. Some things that I haven't made up my mind about: * Better name for `value-less-p`: value< {generic,universal,standard,lisp}{-less-p,<} * Maybe the :destructive keyword be called :inplace or :in-place = instead? Shorter, less violent. * Should the :reverse keyword be called :reversed or even :descending ? * Internally, `value-less-p` computes a 3-way result; it would be easy = to expose that to Lisp as `value-compare`, could be useful. * The design space for `value-less-p` is vast: the current code is an = attempt at intuitive semantics without too much complexity. There are = also good (and bad) arguments for: - heterogeneous comparisons (compare objects of different types) - total order on all values - strict agreement with `equal` - automatic call-out to user-defined comparison functions for classes = that have them