GNU bug report logs - #69709
`sort` interface improvement and universal ordering predicate

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Reported by: Mattias Engdegård <mattias.engdegard@HIDDEN>; dated Sun, 10 Mar 2024 13:29:02 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.

Message received at 69709 <at> debbugs.gnu.org:


Received: (at 69709) by debbugs.gnu.org; 14 Apr 2024 16:26:28 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Apr 14 12:26:28 2024
Received: from localhost ([127.0.0.1]:36044 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1rw2gU-0000Oq-IE
	for submit <at> debbugs.gnu.org; Sun, 14 Apr 2024 12:26:28 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:52200)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1rw2gS-0000NW-2P
 for 69709 <at> debbugs.gnu.org; Sun, 14 Apr 2024 12:26:25 -0400
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 <eliz@HIDDEN>)
 id 1rw2gB-0006sP-8E; Sun, 14 Apr 2024 12:26:07 -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=8iwWIhA2s0YeIvRbA1yu2Am3GPxbo4HE1+xO5LAX3IE=; b=a6q++HjmZz8bJTJCuK5G
 HIvmoCg5FjV/GlprCqsFWIIZXH2U6xy7ZzeMJmLa49etGzBowrg+UPhScGes2SFP1W81faOUiO7ce
 ENpvtaY09l/9pATT5o+1txGwowLddOiSHKYmJ8xUaK40BOv7lvJCz+y44PVoq7qUJKx4nzg7rUDbh
 5t3yMi0rHyibJSRp+gMNWINalPhtXPKJGg/qw4tynBDi6bZDfyhuYj97Eu0gzAZO+B4Gv2YPYVjbJ
 wA17EcM5yGMMVvYq3JAX4G8nu42F3EBak1gE602sbNAELZd/Zr8h7FBvCU8885BfkDIRLF7gjSGzZ
 6O8qVrl+dJ9YHw==;
Date: Sun, 14 Apr 2024 19:26:05 +0300
Message-Id: <86cyqrnc6a.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Aris Spathis <agspathis@HIDDEN>,
 Mattias =?utf-8?Q?Engdeg=C3=A5rd?= <mattiase@HIDDEN>
In-Reply-To: <CAPnC22aT2+uwxByLnr4g78+wWzZ7mWgpDPLRns2rHNseU3EcRg@HIDDEN>
 (message from Aris Spathis on Sun, 14 Apr 2024 17:03:11 +0300)
Subject: Re: bug#69709: `sort` interface improvement and universal ordering
 predicate
References: <D3DD6F8C-55EA-4602-8A8C-3CDD6252CBCB@HIDDEN>
 <CAPnC22aT2+uwxByLnr4g78+wWzZ7mWgpDPLRns2rHNseU3EcRg@HIDDEN>
MIME-version: 1.0
Content-type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 69709
Cc: 69709 <at> debbugs.gnu.org, mattias.engdegard@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> Cc: 69709 <at> debbugs.gnu.org
> From: Aris Spathis <agspathis@HIDDEN>
> Date: Sun, 14 Apr 2024 17:03:11 +0300
> 
> Thank you for your excellent work on `sort` and related functionality!
> 
> Unfortunately, the new `sort` implementation occasionally crashes with a
> segfault. The following code reproduces that in current master:
> 
> (dotimes (i 500)
>   (sort (make-list 128 42)
>         :key (lambda (n) (make-list i n))))
> 
> It happens for inputs of length >= `MERGESTATE_TEMP_SIZE / 2` (= 128
> currently) along with a non-NIL `:key` function. In such cases, a
> `Lisp_Object` array is explicitly heap-allocated to store the keys, which is
> never marked against GC. This would not be a problem if not for the fact that
> the `:key` function call may trigger GC.
> 
> I'm attaching a patch with a proposed solution, consisting of three changes:
> 
> 1. Allocate with `xzalloc` to have the new array initialized to `Qnil`. This
>    ensures its objects can be marked properly.
> 
> 2. Mark `ms->allocated_keys` in `merge_markmem`. We don't need to check that
>    `ms->allocated_keys != NULL`, as `merge_register_cleanup` is only called
>    under this exact condition.
> 
> 3. Move the computation of keys (which may trigger a GC) after `merge_init`,
>    which registers `merge_markmem`.
> 
> I hope this is useful.

Thanks, I took the liberty of CC'ing Mattias using his "usual"
address, in the hope that it will help bring this to his attention
sooner.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#69709; Package emacs. Full text available.

Message received at 69709 <at> debbugs.gnu.org:


Received: (at 69709) by debbugs.gnu.org; 14 Apr 2024 15:20:27 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Apr 14 11:20:26 2024
Received: from localhost ([127.0.0.1]:35974 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1rw1ea-0006vD-Bz
	for submit <at> debbugs.gnu.org; Sun, 14 Apr 2024 11:20:26 -0400
Received: from mail-io1-xd2e.google.com ([2607:f8b0:4864:20::d2e]:55799)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <agspathis@HIDDEN>) id 1rw0SJ-0001D8-Nl
 for 69709 <at> debbugs.gnu.org; Sun, 14 Apr 2024 10:03:41 -0400
Received: by mail-io1-xd2e.google.com with SMTP id
 ca18e2360f4ac-7d6c4c97875so72452839f.3
 for <69709 <at> debbugs.gnu.org>; Sun, 14 Apr 2024 07:03:28 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1713103403; x=1713708203; darn=debbugs.gnu.org;
 h=cc:to:subject:message-id:date:from:mime-version:from:to:cc:subject
 :date:message-id:reply-to;
 bh=z4QHApF9fSKwi+LpdR/FGGwZUDePEdLM9vaCw+ed/DQ=;
 b=GODXobXthbMBCB+LWDmlKIyBGPo1zhz5wVrqAXn+/Rrxkvx/3mR+t+lG65stBovnoG
 1fTJvbS/NJIvvJFIj12oOWOJYNw8wuWETQKBr3Dd5npGDHIVzXvM/8bj7id7+RUk2PuB
 Tt1DAN5OC+DUena0rbjBpklZMcSuHT12bVWcBKn690rdePXlBMmh3v5OVczeZo+oAA1F
 YY67eblDMU8bTgwfzo3cx0M3tr4fSgxLv02DT4ahB6rIt0KwP31wCRH9ahVFkzpfKkbK
 xF7wWqVTCx4cXfn2gXqqeUSnb2NntAt/fa3RiAw3Z+e70594gBv+L5lvS9kI0AqzxXXC
 CZLg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1713103403; x=1713708203;
 h=cc:to:subject:message-id:date:from:mime-version:x-gm-message-state
 :from:to:cc:subject:date:message-id:reply-to;
 bh=z4QHApF9fSKwi+LpdR/FGGwZUDePEdLM9vaCw+ed/DQ=;
 b=ne3ktTfg19Q4Y3TmzpPuxjXmBusIPChYgRRcZHpZYTCH2X2kK0w2Gcf4AtDFgfahOb
 8EJEWlnkUKS7p2sakbSfpGN3EYqBZ9SQGSS7Xhw6Ftvb5wqLGwwkr81oUd+vJHbcDOEI
 LEwciQHvqauYChNCjJc3Jl5DPSWI8LAArhlorLwdNQzFgBigkosp/Tlajlv/jxt7faD3
 0u/CcWvwimXmF3dAR8m9vbqyagxV2jc8/NC/FHTHRoF9Sky0mz7MsjJE4bu1DH0FFFes
 aKQKtMGFcqZZa2E2sPG1kRAVqaCp/F1pUPGj3g+JeM0c4hFSavV9Da6ZCAwB+fMrTmNx
 klNg==
X-Gm-Message-State: AOJu0YyQDiRqh6bLCnmb0IB/J1HLkAofbIIyJyPwTXMFJgW08yfDrrLe
 8aUuex2vB/5sV4N2m2tMl9jbVgqkypUgbpojrbJY3lx8Isz+wUupEwkUZS2MXWDb7d0wzN8VKg9
 auSUFKPTyAQwBwmSkEjrNhR6r1c8=
X-Google-Smtp-Source: AGHT+IE14nNPLGR/ue3FDrRfBUL6xxAGGfRBao8nMEYmW9vN/Ezdbu+bjnYZrMDG7RlHwnYFUaghyeHFD73Fi0Mh0pY=
X-Received: by 2002:a05:6602:418e:b0:7d5:f591:2cc7 with SMTP id
 bx14-20020a056602418e00b007d5f5912cc7mr11661398iob.9.1713103402233; Sun, 14
 Apr 2024 07:03:22 -0700 (PDT)
MIME-Version: 1.0
From: Aris Spathis <agspathis@HIDDEN>
Date: Sun, 14 Apr 2024 17:03:11 +0300
Message-ID: <CAPnC22aT2+uwxByLnr4g78+wWzZ7mWgpDPLRns2rHNseU3EcRg@HIDDEN>
Subject: bug#69709: `sort` interface improvement and universal ordering
 predicate
To: mattias.engdegard@HIDDEN
Content-Type: multipart/mixed; boundary="000000000000c117b406160ef707"
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 69709
X-Mailman-Approved-At: Sun, 14 Apr 2024 11:20:21 -0400
Cc: 69709 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

--000000000000c117b406160ef707
Content-Type: multipart/alternative; boundary="000000000000c117b306160ef705"

--000000000000c117b306160ef705
Content-Type: text/plain; charset="UTF-8"

Thank you for your excellent work on `sort` and related functionality!

Unfortunately, the new `sort` implementation occasionally crashes with a
segfault. The following code reproduces that in current master:

(dotimes (i 500)
  (sort (make-list 128 42)
        :key (lambda (n) (make-list i n))))

It happens for inputs of length >= `MERGESTATE_TEMP_SIZE / 2` (= 128
currently) along with a non-NIL `:key` function. In such cases, a
`Lisp_Object` array is explicitly heap-allocated to store the keys, which is
never marked against GC. This would not be a problem if not for the fact
that
the `:key` function call may trigger GC.

I'm attaching a patch with a proposed solution, consisting of three changes:

1. Allocate with `xzalloc` to have the new array initialized to `Qnil`. This
   ensures its objects can be marked properly.

2. Mark `ms->allocated_keys` in `merge_markmem`. We don't need to check that
   `ms->allocated_keys != NULL`, as `merge_register_cleanup` is only called
   under this exact condition.

3. Move the computation of keys (which may trigger a GC) after `merge_init`,
   which registers `merge_markmem`.

I hope this is useful.

Cheers,
Aris

--000000000000c117b306160ef705
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">Thank you for your excellent work on `sort` and related fu=
nctionality!<br><br>Unfortunately, the new `sort` implementation occasional=
ly crashes with a<br>segfault. The following code reproduces that in curren=
t master:<br><br>(dotimes (i 500)<br>=C2=A0 (sort (make-list 128 42)<br>=C2=
=A0 =C2=A0 =C2=A0 =C2=A0 :key (lambda (n) (make-list i n))))<br><br>It happ=
ens for inputs of length &gt;=3D `MERGESTATE_TEMP_SIZE / 2` (=3D 128<br>cur=
rently) along with a non-NIL `:key` function. In such cases, a<br>`Lisp_Obj=
ect` array is explicitly heap-allocated to store the keys, which is<br>neve=
r marked against GC. This would not be a problem if not for the fact that<b=
r>the `:key` function call may trigger GC.<br><br>I&#39;m attaching a patch=
 with a proposed solution, consisting of three changes:<br><br>1. Allocate =
with `xzalloc` to have the new array initialized to `Qnil`. This<br>=C2=A0 =
=C2=A0ensures its objects can be marked properly.<br><br>2. Mark `ms-&gt;al=
located_keys` in `merge_markmem`. We don&#39;t need to check that<br>=C2=A0=
 =C2=A0`ms-&gt;allocated_keys !=3D NULL`, as `merge_register_cleanup` is on=
ly called<br>=C2=A0 =C2=A0under this exact condition.<br><br>3. Move the co=
mputation of keys (which may trigger a GC) after `merge_init`,<br>=C2=A0 =
=C2=A0which registers `merge_markmem`.<br><br>I hope this is useful.<br><br=
>Cheers,<br><div>Aris</div><br></div>

--000000000000c117b306160ef705--

--000000000000c117b406160ef707
Content-Type: text/x-patch; charset="US-ASCII"; name="sort-segfault-fix.patch"
Content-Disposition: attachment; filename="sort-segfault-fix.patch"
Content-Transfer-Encoding: base64
Content-ID: <f_luzl9p7d0>
X-Attachment-Id: f_luzl9p7d0

ZGlmZiAtLWdpdCBhL3NyYy9zb3J0LmMgYi9zcmMvc29ydC5jCmluZGV4IDUyN2Q1NTUwMzQyLi41
NjJmODhlZGUzYyAxMDA2NDQKLS0tIGEvc3JjL3NvcnQuYworKysgYi9zcmMvc29ydC5jCkBAIC01
MzIsNiArNTMyLDggQEAgbWVyZ2VfbWFya21lbSAodm9pZCAqYXJnKQogICBtZXJnZV9zdGF0ZSAq
bXMgPSBhcmc7CiAgIGVhc3N1bWUgKG1zICE9IE5VTEwpOwogCisgIG1hcmtfb2JqZWN0cyAobXMt
PmFsbG9jYXRlZF9rZXlzLCBtcy0+bGlzdGxlbik7CisKICAgaWYgKG1zLT5yZWxvYy5zaXplICE9
IE5VTEwgJiYgKm1zLT5yZWxvYy5zaXplID4gMCkKICAgICB7CiAgICAgICBMaXNwX09iamVjdCAq
c3JjID0gKG1zLT5yZWxvYy5zcmMtPnZhbHVlcwpAQCAtMTEwNywyMSArMTEwOSwyOSBAQCB0aW1f
c29ydCAoTGlzcF9PYmplY3QgcHJlZGljYXRlLCBMaXNwX09iamVjdCBrZXlmdW5jLAogICAgICAg
aWYgKGxlbmd0aCA8IE1FUkdFU1RBVEVfVEVNUF9TSVpFIC8gMikKIAlrZXlzID0gJm1zLnRlbXBh
cnJheVtsZW5ndGggKyAxXTsKICAgICAgIGVsc2UKLQlrZXlzID0gYWxsb2NhdGVkX2tleXMgPSB4
bWFsbG9jIChsZW5ndGggKiB3b3JkX3NpemUpOwotCi0gICAgICBmb3IgKHB0cmRpZmZfdCBpID0g
MDsgaSA8IGxlbmd0aDsgaSsrKQotCWtleXNbaV0gPSBjYWxsMSAoa2V5ZnVuYywgc2VxW2ldKTsK
Kwl7CisJICAvKiBBbGxvY2F0ZSB3aXRoIHh6YWxsb2MgdG8gb2J0YWluIGFuIGFycmF5IG9mIHZh
bGlkCisJICAgICBMaXNwX09iamVjdHMgKFFuaWxzKSwgc28gdGhhdCB0aGV5IGNhbiBiZSBtYXJr
ZWQuICovCisJICB2ZXJpZnkgKE5JTF9JU19aRVJPKTsKKwkgIGtleXMgPSBhbGxvY2F0ZWRfa2V5
cyA9IHh6YWxsb2MgKGxlbmd0aCAqIHdvcmRfc2l6ZSk7CisJfQogCiAgICAgICBsby5rZXlzID0g
a2V5czsKICAgICAgIGxvLnZhbHVlcyA9IHNlcTsKICAgICB9CiAKKyAgbWVyZ2VfaW5pdCAoJm1z
LCBsZW5ndGgsIGFsbG9jYXRlZF9rZXlzLCAmbG8sIHByZWRpY2F0ZSk7CisKKyAgLyogQ29tcHV0
ZSBrZXlzIGFmdGVyIG1lcmdlX21hcmttZW0gaGFzIGJlZW4gcmVnaXN0ZXJlZCBieSBtZXJnZV9p
bml0CisgICAgIChhbnkgY2FsbCB0byBrZXlmdW5jIG1pZ2h0IHRyaWdnZXIgYSBHQykuICovCisg
IGlmICghTklMUCAoa2V5ZnVuYykpCisgICAgZm9yIChwdHJkaWZmX3QgaSA9IDA7IGkgPCBsZW5n
dGg7IGkrKykKKyAgICAgIGtleXNbaV0gPSBjYWxsMSAoa2V5ZnVuYywgc2VxW2ldKTsKKwogICAv
KiBGSVhNRTogVGhpcyBpcyB3aGVyZSB3ZSB3b3VsZCBjaGVjayB0aGUga2V5cyBmb3IgaW50ZXJl
c3RpbmcKICAgICAgcHJvcGVydGllcyBmb3IgbW9yZSBvcHRpbWlzZWQgY29tcGFyaXNvbiAoc3Vj
aCBhcyBhbGwgYmVpbmcgZml4bnVtcwogICAgICBldGMpLiAgKi8KIAotICBtZXJnZV9pbml0ICgm
bXMsIGxlbmd0aCwgYWxsb2NhdGVkX2tleXMsICZsbywgcHJlZGljYXRlKTsKLQogICAvKiBNYXJj
aCBvdmVyIHRoZSBhcnJheSBvbmNlLCBsZWZ0IHRvIHJpZ2h0LCBmaW5kaW5nIG5hdHVyYWwgcnVu
cywKICAgICAgYW5kIGV4dGVuZGluZyBzaG9ydCBuYXR1cmFsIHJ1bnMgdG8gbWlucnVuIGVsZW1l
bnRzLiAgKi8KICAgY29uc3QgcHRyZGlmZl90IG1pbnJ1biA9IG1lcmdlX2NvbXB1dGVfbWlucnVu
IChsZW5ndGgpOwo=
--000000000000c117b406160ef707--




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#69709; Package emacs. Full text available.

Message received at 69709 <at> debbugs.gnu.org:


Received: (at 69709) by debbugs.gnu.org; 29 Mar 2024 18:09:29 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Mar 29 14:09:29 2024
Received: from localhost ([127.0.0.1]:43403 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1rqGfQ-0007ON-Fc
	for submit <at> debbugs.gnu.org; Fri, 29 Mar 2024 14:09:28 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:56364)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1rqGfO-0007OA-7o
 for 69709 <at> debbugs.gnu.org; Fri, 29 Mar 2024 14:09:27 -0400
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 <eliz@HIDDEN>)
 id 1rqGfG-0002wy-Qb; Fri, 29 Mar 2024 14:09:18 -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=tvZBe238RMpPuJ9JFycjnOab7mE1URk+sVUNeMO5zCU=; b=Fy/+A8kATl5ZZXuzkPjU
 8idl6q/g0cKK7kf4uN7bDqAe+yXWm/tGcawbHWY5JzgGhTxc/WRchR+M73e1WJpEVI+rv5TvI4HK+
 hsHo3D01aALRv/SlVnue3tlOMGd5G8mzbVMgXVWBDjtcqfeq3DoJiPiGvhNr7Tcnd6satSaSBCStu
 4d5tv0tB128p7rDHjv9d6h5uhnT+p+V8+fcUuuyghxnHw9G0ixPnGSXfvtiH52yIJlqQI/eC1uCSd
 hdnAhb9hTQVJXusNMGnoAWkGQCegT3erQvkrtZZrUyVFvfP1zxsI4h+44cQWhosg4prKAo8l7jV4h
 8HVmxyYOp3UQlQ==;
Date: Fri, 29 Mar 2024 21:09:16 +0300
Message-Id: <86h6goewqb.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Mattias =?utf-8?Q?Engdeg=C3=A5rd?= <mattias.engdegard@HIDDEN>
In-Reply-To: <8CBBCED8-DEDF-44D1-8D52-D21E32E6621D@HIDDEN> (message from
 Mattias =?utf-8?Q?Engdeg=C3=A5rd?= on Fri, 29 Mar 2024 17:13:33 +0100)
Subject: Re: bug#69709: `sort` interface improvement and universal ordering
 predicate
References: <D3DD6F8C-55EA-4602-8A8C-3CDD6252CBCB@HIDDEN>
 <86zfv6uqjn.fsf@HIDDEN> <4391448A-C7AF-4D7F-8866-C0313956D52D@HIDDEN>
 <8366111E-97C4-4839-AA1E-A577C81A6035@HIDDEN>
 <bdfec2fb-8dfa-4222-8e6d-564dbd5cb982@HIDDEN>
 <4B7ACA81-DEB9-4878-BE0B-88A302AF7081@HIDDEN>
 <e1d5cc5c-c15d-4c61-bead-80794040ab1f@HIDDEN>
 <jwvmsqo7lwl.fsf-monnier+emacs@HIDDEN>
 <d619f326-21c8-4d6e-88bc-5d87cda18507@HIDDEN>
 <jwvsf0g5y8c.fsf-monnier+emacs@HIDDEN>
 <2BB79019-C075-445C-A9E0-9D29929EA02A@HIDDEN>
 <7219B5AB-4EA7-4050-92AE-7FB949D6D415@HIDDEN> <86y1a1dyz6.fsf@HIDDEN>
 <51D040A5-AC7C-485C-A0C9-DFCFF3DDA510@HIDDEN> <86o7axdpap.fsf@HIDDEN>
 <8CBBCED8-DEDF-44D1-8D52-D21E32E6621D@HIDDEN>
MIME-version: 1.0
Content-type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 69709
Cc: 69709 <at> debbugs.gnu.org, dmitry@HIDDEN, gerd.moellmann@HIDDEN,
 monnier@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> From: Mattias Engdegård <mattias.engdegard@HIDDEN>
> Date: Fri, 29 Mar 2024 17:13:33 +0100
> Cc: monnier@HIDDEN,
>  dmitry@HIDDEN,
>  69709 <at> debbugs.gnu.org,
>  gerd.moellmann@HIDDEN
> 
> 29 mars 2024 kl. 16.35 skrev Eli Zaretskii <eliz@HIDDEN>:
> 
> > Makeinfo can handle @code{@var{..}} just fine, we have that in many
> > other places, so that's not a concern.  It is indeed possible to use
> > @asis in @table, and then mark each @item with @code, but that's just
> > too much trouble; "@table @code" exists to save us that...
> 
> Looking at the PDF makes me think that we should decide whether we prefer
> 
>   @code{:keyword @var{variable}}
> 
> or
> 
>   @code{:keyword} @var{variable}
> 
> in general. I can think of arguments for either but consistency would be even better.

The former is the correct one.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#69709; Package emacs. Full text available.

Message received at 69709 <at> debbugs.gnu.org:


Received: (at 69709) by debbugs.gnu.org; 29 Mar 2024 16:13:46 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Mar 29 12:13:46 2024
Received: from localhost ([127.0.0.1]:43248 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1rqErS-0001bP-6H
	for submit <at> debbugs.gnu.org; Fri, 29 Mar 2024 12:13:46 -0400
Received: from mail-lj1-x229.google.com ([2a00:1450:4864:20::229]:55683)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <mattias.engdegard@HIDDEN>) id 1rqErP-0001bA-BJ
 for 69709 <at> debbugs.gnu.org; Fri, 29 Mar 2024 12:13:44 -0400
Received: by mail-lj1-x229.google.com with SMTP id
 38308e7fff4ca-2d715638540so11566081fa.3
 for <69709 <at> debbugs.gnu.org>; Fri, 29 Mar 2024 09:13:41 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1711728815; x=1712333615; 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=UkSyYrvpohawBHgOsPhYlQU6qEZYA+TlglKZDxcq4/Y=;
 b=Y+T4HNSgbnuB9fAinffzdOE78ydAkbuQLDhIdieqoas32PXPUCQJ4YDH06i98hllVW
 S1FDGed5OY6th7UgIexZ3yiMIe59qdda2l9KwODzfmKZgR/uQtbE+TjpOQPm/s5RCo+0
 TGlOGtZN5wGGrnW5HJ23smobPDy0+n4+SsKjI4rZA/pXGgqt9P8ESFsXLanJMxG4DxT+
 I9/U7/RhJugU/8q5cWmK5bk29cYa4fcDJT78Dwb09mM9FbZFxo+MxRxa/9xdu1a0/0RA
 z/WqHy7Tx+hYes5nt8nGiTiq3NRay0CH1hXo+QMmKrCzNALKtY5vF9wOnFw7HD+xiK/I
 HSBA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1711728815; x=1712333615;
 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=UkSyYrvpohawBHgOsPhYlQU6qEZYA+TlglKZDxcq4/Y=;
 b=kJVq3fmHwvTaNVS4LWFsKttd20W0tLFvNkWrL32UcxEpE6IosaEJSD1Q16rDtNXTC0
 TCtbSe+0HwzrtbajxX+9F2q4hqcd39n5uZ5ppT43BTARB1DMmluKkyMz4sFa5wsz/4zi
 oB/S7SDmGd6RQoRmYot0qvRt1GEKTZuKcjiy7th2+7vZ8wij3aZ8Dhn42MmVMEpOd18W
 n6nGugDY9t30av+SQkqI2gVoPt8kW8FHBfcgKC071hcK6U/9OYiEQgBrVsgdfQmeSuOb
 gRLK9v9hF07AuA3TlYy2QR6VzMBM1zTkj03VGK1tyj0BoWrkfsw3VBQXMOdIeNlMHKB0
 qWfg==
X-Forwarded-Encrypted: i=1;
 AJvYcCXlr7GaO3DMzKZmrnJvDxCZnIKvrUXcsTr8OJv48n/wpJ3wy54cv0ijfBVVMppj7XoYGDUSvcuOMe9O+QlJa+vxPh45JlA=
X-Gm-Message-State: AOJu0YxnlRFGHzDKc1HBDuNwR/2oYB+wYLa00DWBx8oZ5A7p2WUXxLqz
 UeqXdnn0COo4vAXvEmEe3hcl8u86AOnRCd7n5OFxDfcej7gkOUyj
X-Google-Smtp-Source: AGHT+IHJidZ+7cJAV81/8DJqqt+UBzcDFBlcd7ocBmV8JundYtYinfUWzWRLgvDDF5lztFSuw/saXA==
X-Received: by 2002:ac2:5a4b:0:b0:513:d1c7:7d37 with SMTP id
 r11-20020ac25a4b000000b00513d1c77d37mr1847432lfn.51.1711728815270; 
 Fri, 29 Mar 2024 09:13:35 -0700 (PDT)
Received: from smtpclient.apple (c80-217-1-132.bredband.tele2.se.
 [80.217.1.132]) by smtp.gmail.com with ESMTPSA id
 28-20020ac25f1c000000b00515b50d4a37sm666942lfq.278.2024.03.29.09.13.34
 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128);
 Fri, 29 Mar 2024 09:13:34 -0700 (PDT)
Content-Type: text/plain;
	charset=us-ascii
Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.120.0.1.15\))
Subject: Re: bug#69709: `sort` interface improvement and universal ordering
 predicate
From: =?utf-8?Q?Mattias_Engdeg=C3=A5rd?= <mattias.engdegard@HIDDEN>
In-Reply-To: <86o7axdpap.fsf@HIDDEN>
Date: Fri, 29 Mar 2024 17:13:33 +0100
Content-Transfer-Encoding: quoted-printable
Message-Id: <8CBBCED8-DEDF-44D1-8D52-D21E32E6621D@HIDDEN>
References: <D3DD6F8C-55EA-4602-8A8C-3CDD6252CBCB@HIDDEN>
 <86zfv6uqjn.fsf@HIDDEN> <4391448A-C7AF-4D7F-8866-C0313956D52D@HIDDEN>
 <8366111E-97C4-4839-AA1E-A577C81A6035@HIDDEN>
 <bdfec2fb-8dfa-4222-8e6d-564dbd5cb982@HIDDEN>
 <4B7ACA81-DEB9-4878-BE0B-88A302AF7081@HIDDEN>
 <e1d5cc5c-c15d-4c61-bead-80794040ab1f@HIDDEN>
 <jwvmsqo7lwl.fsf-monnier+emacs@HIDDEN>
 <d619f326-21c8-4d6e-88bc-5d87cda18507@HIDDEN>
 <jwvsf0g5y8c.fsf-monnier+emacs@HIDDEN>
 <2BB79019-C075-445C-A9E0-9D29929EA02A@HIDDEN>
 <7219B5AB-4EA7-4050-92AE-7FB949D6D415@HIDDEN> <86y1a1dyz6.fsf@HIDDEN>
 <51D040A5-AC7C-485C-A0C9-DFCFF3DDA510@HIDDEN> <86o7axdpap.fsf@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
X-Mailer: Apple Mail (2.3654.120.0.1.15)
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 69709
Cc: 69709 <at> debbugs.gnu.org, dmitry@HIDDEN, gerd.moellmann@HIDDEN,
 monnier@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

29 mars 2024 kl. 16.35 skrev Eli Zaretskii <eliz@HIDDEN>:

> The canonical sorting order for overlays is in compare_overlays,
> AFAIK.

Maybe, but I haven't see much Lisp code trying to use an order like that =
-- sorting overlays is common but is done with all kinds of orders. =
Perhaps I haven't looked very carefully.
In any case, maybe compare_overlays would work as a starting point. It =
seems to focus on vertical order (by priority), but much Lisp code sorts =
overlays horizontally (by position).

> Makeinfo can handle @code{@var{..}} just fine, we have that in many
> other places, so that's not a concern.  It is indeed possible to use
> @asis in @table, and then mark each @item with @code, but that's just
> too much trouble; "@table @code" exists to save us that...

Looking at the PDF makes me think that we should decide whether we =
prefer

  @code{:keyword @var{variable}}

or

  @code{:keyword} @var{variable}

in general. I can think of arguments for either but consistency would be =
even better.

> I think the places where keywords don't have the @code markup are
> simply wrong.

Yes, I agree.





Information forwarded to bug-gnu-emacs@HIDDEN:
bug#69709; Package emacs. Full text available.

Message received at 69709 <at> debbugs.gnu.org:


Received: (at 69709) by debbugs.gnu.org; 29 Mar 2024 15:35:23 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Mar 29 11:35:23 2024
Received: from localhost ([127.0.0.1]:43216 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1rqEGJ-00085d-BX
	for submit <at> debbugs.gnu.org; Fri, 29 Mar 2024 11:35:23 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:45564)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1rqEGH-00085P-0s
 for 69709 <at> debbugs.gnu.org; Fri, 29 Mar 2024 11:35:22 -0400
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 <eliz@HIDDEN>)
 id 1rqEG9-0001Il-6A; Fri, 29 Mar 2024 11:35:13 -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=oRh88GykZ8U9SD5DDgoVJin+GyW7BlECggry5Q078U0=; b=Ht2VcZxhIwx2jsv8ww1I
 EtyBrc8vfRoBRyjhMICk9Y5r6z3lZ8oC9T42NY1C2fvRYdOSACpoaX67zXztwWTnbidbpqdK2Sz6e
 6TOOr73HvZvq9KykBPvXUJMBjQZeJBZXhKtm1OgnXfqrGPAjyHtT7niACLeDu7QjA7IZp9bDvjH44
 F3YqVrq3wCWh0mvskCKPiYFSXrsPbPHdLZm4FfAqMErcXSrEbic8+u8CtNGrzpHkGVLjZRMXKNSPq
 BWDAJEz8eQbjr7FWHMP5Bz00XzC5mPQKtNMHhTw1bZOZyJFsIIBPTGSH8ifyusVlT3OJwurdrgqnn
 XHa7hTuT5VP99A==;
Date: Fri, 29 Mar 2024 18:35:10 +0300
Message-Id: <86o7axdpap.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Mattias =?utf-8?Q?Engdeg=C3=A5rd?= <mattias.engdegard@HIDDEN>
In-Reply-To: <51D040A5-AC7C-485C-A0C9-DFCFF3DDA510@HIDDEN> (message from
 Mattias =?utf-8?Q?Engdeg=C3=A5rd?= on Fri, 29 Mar 2024 16:02:01 +0100)
Subject: Re: bug#69709: `sort` interface improvement and universal ordering
 predicate
References: <D3DD6F8C-55EA-4602-8A8C-3CDD6252CBCB@HIDDEN>
 <86zfv6uqjn.fsf@HIDDEN> <4391448A-C7AF-4D7F-8866-C0313956D52D@HIDDEN>
 <8366111E-97C4-4839-AA1E-A577C81A6035@HIDDEN>
 <bdfec2fb-8dfa-4222-8e6d-564dbd5cb982@HIDDEN>
 <4B7ACA81-DEB9-4878-BE0B-88A302AF7081@HIDDEN>
 <e1d5cc5c-c15d-4c61-bead-80794040ab1f@HIDDEN>
 <jwvmsqo7lwl.fsf-monnier+emacs@HIDDEN>
 <d619f326-21c8-4d6e-88bc-5d87cda18507@HIDDEN>
 <jwvsf0g5y8c.fsf-monnier+emacs@HIDDEN>
 <2BB79019-C075-445C-A9E0-9D29929EA02A@HIDDEN>
 <7219B5AB-4EA7-4050-92AE-7FB949D6D415@HIDDEN> <86y1a1dyz6.fsf@HIDDEN>
 <51D040A5-AC7C-485C-A0C9-DFCFF3DDA510@HIDDEN>
MIME-version: 1.0
Content-type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 69709
Cc: 69709 <at> debbugs.gnu.org, dmitry@HIDDEN, gerd.moellmann@HIDDEN,
 monnier@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> From: Mattias Engdegård <mattias.engdegard@HIDDEN>
> Date: Fri, 29 Mar 2024 16:02:01 +0100
> Cc: monnier@HIDDEN,
>  dmitry@HIDDEN,
>  69709 <at> debbugs.gnu.org,
>  gerd.moellmann@HIDDEN
> 
> 29 mars 2024 kl. 13.06 skrev Eli Zaretskii <eliz@HIDDEN>:
> 
> > . The description of value< says "lexicographic order" about some
> >   types, but I think that is not clear enough, and we should tell
> >   explicitly how the comparison works in those cases.
> 
> That's a good point. Since it is standard terminology I will explain it in the manual but leave the doc string as it is -- this is our usual practice, right?

That'd be fine, thanks.

> > . AFAICT, no ordering is defined for overlays, and I wonder why.  I
> >   think this could be very useful; we certainly sort overlays in C in
> >   several places.
> 
> Yes, the plan was to add ordering for more types as we figure out which ones are missing. Basically, if a type has a useful ordering that is well-defined, we should probably add it.
> 
> That's one reason why I didn't include overlays from the beginning: I couldn't easily find one obvious ordering that would make intuitive sense, and I'd rather leave them unordered than define something useless. Code that sorts overlays uses a variety of criteria: priority, starting position, application-specific properties, and so on.

The canonical sorting order for overlays is in compare_overlays,
AFAIK.

> Thank you for the markup fixes, by the way. One question:
> 
> > -@table @asis
> > +@table @code
> 
> I used @asis because that is what the entries for some other functions using key-value arguments used, like `make-process`. Clearly the keyword should be marked up as @code, but should it encompass the @var{argument} part as well? Or should we use @asis and then explicit @code in each @item?

Makeinfo can handle @code{@var{..}} just fine, we have that in many
other places, so that's not a concern.  It is indeed possible to use
@asis in @table, and then mark each @item with @code, but that's just
too much trouble; "@table @code" exists to save us that...

I think the places where keywords don't have the @code markup are
simply wrong.  This should be most evident in the printed format of
the manual, where @code produces a distinct typeface, but doesn't have
the quotes around it.  Maybe you could produce the PDF manual and see
the difference by yourself.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#69709; Package emacs. Full text available.

Message received at 69709 <at> debbugs.gnu.org:


Received: (at 69709) by debbugs.gnu.org; 29 Mar 2024 15:02:22 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Mar 29 11:02:22 2024
Received: from localhost ([127.0.0.1]:43155 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1rqDkJ-0006NK-Cq
	for submit <at> debbugs.gnu.org; Fri, 29 Mar 2024 11:02:22 -0400
Received: from mail-lf1-x134.google.com ([2a00:1450:4864:20::134]:51209)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <mattias.engdegard@HIDDEN>) id 1rqDkE-0006Mv-1s
 for 69709 <at> debbugs.gnu.org; Fri, 29 Mar 2024 11:02:18 -0400
Received: by mail-lf1-x134.google.com with SMTP id
 2adb3069b0e04-513e25afabaso2227578e87.2
 for <69709 <at> debbugs.gnu.org>; Fri, 29 Mar 2024 08:02:12 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1711724526; x=1712329326; 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=XNqovXLTTE4b/Dvm4dkiVTdtxmEha8Tm7IiVFa2dKeA=;
 b=hHnKKiuXJpFdOUsvNz6Wtj8opPRBY370WPtWseoZ3TBmtt/sO3ughhLxYcF3roxcoP
 CbYRRnGGY29sEnPVXY0Qn4viPqZvfPKKlVO612VpAeqAine3Eja09ErTQ7SVSZonL4mC
 rz4TkaVKnlPvNMnXSHHiPyr+soZrrsojjrfbrpT1ldEvDYXKYOqTroQ37O1/+vmu2Uxm
 jnz7U3Ml1jl06pt5ahn4XyxM4f20pzBV2O9B77fK1q5jSFm6yoR37UyXLet27ZW116Cc
 9YTlQAoSD0fR69TkGdpsOxIopk2Pyc8jEjBC7Q6I/oUNSl4SpQYNHN5t2ZTIwT3B6HEO
 xgYg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1711724526; x=1712329326;
 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=XNqovXLTTE4b/Dvm4dkiVTdtxmEha8Tm7IiVFa2dKeA=;
 b=sXY5E9Y+pC2W+JSsHsWw5Ec9jfhCe7ryHMfuJxxuuioLBjLDQRTThCohwFI0W0m/Nn
 9pa44aAm/KxKJoc7+FK3UxwTB4adpVsDj15luUf4kMsZS8ILbmsecfjPiO1tbdPcutpC
 7XdD+1bQM8nYJv0TeEIc56yE8gd5I128BuQHNMPljJMzYJOBdIh5Qyp8gKNRSA/8D+bd
 rzXWEjqJ/Vdy5hR3Gmzlg/yAfCdrElxLsjbiLSvGNxIpyJyA4Bf5oiqwKVQnr/TrpHvP
 qI6X4xtPBbwiMt+cyr7g9bE7viHtzhFBMOeMoSeSZKZ0CYHeAz7U+khkIyvz0MpzA9K+
 sgnQ==
X-Forwarded-Encrypted: i=1;
 AJvYcCXwQrIMKwcN9HO7bVPKm3C5xywwCR9hdyjUE5SQl+u7bW8Uldrjv5WV8RFRgNpqKNEpYZodldB3gT2608JhV4JIrUM3Gjo=
X-Gm-Message-State: AOJu0YzAAtIhXlT4BcsD00XmOelQIsLxJopk9ciuRPW1z6I2sPL70mhf
 bvEQt1hJJumrIn+0RUTWTqycrIX5PS+oWk/47cSKmIs/PJwO2fcV
X-Google-Smtp-Source: AGHT+IEEC8t3zAq+oGP4T4JosY+YFUY/sOJIsYziQ7KmxnZrgyiMGMEhsMvB6TwvZSPqT8uj7befng==
X-Received: by 2002:a05:6512:311b:b0:515:c059:bac3 with SMTP id
 n27-20020a056512311b00b00515c059bac3mr1509932lfb.31.1711724525949; 
 Fri, 29 Mar 2024 08:02:05 -0700 (PDT)
Received: from smtpclient.apple (c80-217-1-132.bredband.tele2.se.
 [80.217.1.132]) by smtp.gmail.com with ESMTPSA id
 g1-20020a0565123b8100b00515bb3c93desm647968lfv.211.2024.03.29.08.02.04
 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128);
 Fri, 29 Mar 2024 08:02:04 -0700 (PDT)
Content-Type: text/plain;
	charset=us-ascii
Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.120.0.1.15\))
Subject: Re: bug#69709: `sort` interface improvement and universal ordering
 predicate
From: =?utf-8?Q?Mattias_Engdeg=C3=A5rd?= <mattias.engdegard@HIDDEN>
In-Reply-To: <86y1a1dyz6.fsf@HIDDEN>
Date: Fri, 29 Mar 2024 16:02:01 +0100
Content-Transfer-Encoding: quoted-printable
Message-Id: <51D040A5-AC7C-485C-A0C9-DFCFF3DDA510@HIDDEN>
References: <D3DD6F8C-55EA-4602-8A8C-3CDD6252CBCB@HIDDEN>
 <86zfv6uqjn.fsf@HIDDEN> <4391448A-C7AF-4D7F-8866-C0313956D52D@HIDDEN>
 <8366111E-97C4-4839-AA1E-A577C81A6035@HIDDEN>
 <bdfec2fb-8dfa-4222-8e6d-564dbd5cb982@HIDDEN>
 <4B7ACA81-DEB9-4878-BE0B-88A302AF7081@HIDDEN>
 <e1d5cc5c-c15d-4c61-bead-80794040ab1f@HIDDEN>
 <jwvmsqo7lwl.fsf-monnier+emacs@HIDDEN>
 <d619f326-21c8-4d6e-88bc-5d87cda18507@HIDDEN>
 <jwvsf0g5y8c.fsf-monnier+emacs@HIDDEN>
 <2BB79019-C075-445C-A9E0-9D29929EA02A@HIDDEN>
 <7219B5AB-4EA7-4050-92AE-7FB949D6D415@HIDDEN> <86y1a1dyz6.fsf@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
X-Mailer: Apple Mail (2.3654.120.0.1.15)
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 69709
Cc: 69709 <at> debbugs.gnu.org, dmitry@HIDDEN, gerd.moellmann@HIDDEN,
 monnier@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

29 mars 2024 kl. 13.06 skrev Eli Zaretskii <eliz@HIDDEN>:

> . The description of value< says "lexicographic order" about some
>   types, but I think that is not clear enough, and we should tell
>   explicitly how the comparison works in those cases.

That's a good point. Since it is standard terminology I will explain it =
in the manual but leave the doc string as it is -- this is our usual =
practice, right?

> . AFAICT, no ordering is defined for overlays, and I wonder why.  I
>   think this could be very useful; we certainly sort overlays in C in
>   several places.

Yes, the plan was to add ordering for more types as we figure out which =
ones are missing. Basically, if a type has a useful ordering that is =
well-defined, we should probably add it.

That's one reason why I didn't include overlays from the beginning: I =
couldn't easily find one obvious ordering that would make intuitive =
sense, and I'd rather leave them unordered than define something =
useless. Code that sorts overlays uses a variety of criteria: priority, =
starting position, application-specific properties, and so on.

> . Various fine details about value< are never mentioned: the fact
>   that there's a limit to recursion, the special treatment of nil in
>   some cases, etc.  I think we should document them, at least in the
>   doc string if not in the manual as well.

Right -- the depth limit is very much like that of `equal` which is =
documented in the manual but not the doc string; I'll probably do the =
same for `value<`. `nil` deserves a note about its dual nature (symbol =
and list) as well.

Thank you for the markup fixes, by the way. One question:

> -@table @asis
> +@table @code

I used @asis because that is what the entries for some other functions =
using key-value arguments used, like `make-process`. Clearly the keyword =
should be marked up as @code, but should it encompass the @var{argument} =
part as well? Or should we use @asis and then explicit @code in each =
@item?





Information forwarded to bug-gnu-emacs@HIDDEN:
bug#69709; Package emacs. Full text available.

Message received at 69709 <at> debbugs.gnu.org:


Received: (at 69709) by debbugs.gnu.org; 29 Mar 2024 12:06:17 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Mar 29 08:06:17 2024
Received: from localhost ([127.0.0.1]:41847 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1rqAzx-0005Yb-B6
	for submit <at> debbugs.gnu.org; Fri, 29 Mar 2024 08:06:17 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:59536)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1rqAzv-0005YH-Ay
 for 69709 <at> debbugs.gnu.org; Fri, 29 Mar 2024 08:06:16 -0400
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 <eliz@HIDDEN>)
 id 1rqAzo-0001dD-FP; Fri, 29 Mar 2024 08:06:08 -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=3KHYMnE7dnnhwAtfspszyPExojnVhRGxnK1ezBhRfzg=; b=WbXsL3ELZRDaYG/C/dc5
 Ph7RL3VnLqvh23tlc24U/DFjoCKQtelMA05ETs64Xow6tz+1FBC49vhSB8c8ATqcbts3IumB+kD+P
 6mABlSVaBKykFReiSijKNe4pPr8j+ntA7s8ezARPc/RS+jLrYhe92mYEs58TpPFxij39go4ZLXFPV
 cesw8FzfXdemTaGO0qH6xk7afWlHZftINstCPgTAV0cDAsvUU74pnoCT3ojFNgEwR1UMQlu+KbACn
 QCn7tswT6QBdD0vQ5pUc3D48NnmQgNFjj2ch0LbvxFD1ujaHL2CzAXJJGMjaLt2uLnWsd4pnejcu0
 HQ9M1TGUITTGDQ==;
Date: Fri, 29 Mar 2024 15:06:05 +0300
Message-Id: <86y1a1dyz6.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Mattias =?utf-8?Q?Engdeg=C3=A5rd?= <mattias.engdegard@HIDDEN>
In-Reply-To: <7219B5AB-4EA7-4050-92AE-7FB949D6D415@HIDDEN> (message from
 Mattias =?utf-8?Q?Engdeg=C3=A5rd?= on Fri, 29 Mar 2024 11:59:39 +0100)
Subject: Re: bug#69709: `sort` interface improvement and universal ordering
 predicate
References: <D3DD6F8C-55EA-4602-8A8C-3CDD6252CBCB@HIDDEN>
 <86zfv6uqjn.fsf@HIDDEN> <4391448A-C7AF-4D7F-8866-C0313956D52D@HIDDEN>
 <8366111E-97C4-4839-AA1E-A577C81A6035@HIDDEN>
 <bdfec2fb-8dfa-4222-8e6d-564dbd5cb982@HIDDEN>
 <4B7ACA81-DEB9-4878-BE0B-88A302AF7081@HIDDEN>
 <e1d5cc5c-c15d-4c61-bead-80794040ab1f@HIDDEN>
 <jwvmsqo7lwl.fsf-monnier+emacs@HIDDEN>
 <d619f326-21c8-4d6e-88bc-5d87cda18507@HIDDEN>
 <jwvsf0g5y8c.fsf-monnier+emacs@HIDDEN>
 <2BB79019-C075-445C-A9E0-9D29929EA02A@HIDDEN>
 <7219B5AB-4EA7-4050-92AE-7FB949D6D415@HIDDEN>
MIME-version: 1.0
Content-type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 69709
Cc: 69709 <at> debbugs.gnu.org, dmitry@HIDDEN, gerd.moellmann@HIDDEN,
 monnier@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> From: Mattias Engdegård <mattias.engdegard@HIDDEN>
> Date: Fri, 29 Mar 2024 11:59:39 +0100
> Cc: Dmitry Gutov <dmitry@HIDDEN>,
>  Eli Zaretskii <eliz@HIDDEN>,
>  69709 <at> debbugs.gnu.org,
>  Gerd Möllmann <gerd.moellmann@HIDDEN>
> 
> 25 mars 2024 kl. 12.11 skrev Mattias Engdegård <mattias.engdegard@HIDDEN>:
> 
> > The plan is to add scratch/sort-key to master in a few days if no serious issues turn up.
> 
> Plan executed.

Thanks.

I have a few comments/questions about value<:

 . The description of value< says "lexicographic order" about some
   types, but I think that is not clear enough, and we should tell
   explicitly how the comparison works in those cases.  AFAIU, the
   corresponding elements are compared by recursively calling value<
   for them? And what happens if one has more elements than the other?
   These are all questions that popped up when I read the new text,
   and I think they should be answered in the text.
 . AFAICT, no ordering is defined for overlays, and I wonder why.  I
   think this could be very useful; we certainly sort overlays in C in
   several places.
 . Various fine details about value< are never mentioned: the fact
   that there's a limit to recursion, the special treatment of nil in
   some cases, etc.  I think we should document them, at least in the
   doc string if not in the manual as well.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#69709; Package emacs. Full text available.

Message received at 69709 <at> debbugs.gnu.org:


Received: (at 69709) by debbugs.gnu.org; 29 Mar 2024 11:52:49 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Mar 29 07:52:49 2024
Received: from localhost ([127.0.0.1]:41826 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1rqAmv-0004vp-C7
	for submit <at> debbugs.gnu.org; Fri, 29 Mar 2024 07:52:49 -0400
Received: from mail-lf1-x130.google.com ([2a00:1450:4864:20::130]:52255)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <mattias.engdegard@HIDDEN>) id 1rqAmt-0004vZ-0s
 for 69709 <at> debbugs.gnu.org; Fri, 29 Mar 2024 07:52:47 -0400
Received: by mail-lf1-x130.google.com with SMTP id
 2adb3069b0e04-51381021af1so2718677e87.0
 for <69709 <at> debbugs.gnu.org>; Fri, 29 Mar 2024 04:52:45 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1711713159; x=1712317959; darn=debbugs.gnu.org;
 h=references:to:cc:in-reply-to:date:subject:mime-version:message-id
 :from:sender:from:to:cc:subject:date:message-id:reply-to;
 bh=OBylIq5aIReUeJMgDsgysa+ZrwZbh8pep2+zpJG/XiI=;
 b=kmni/M+b2PaRdU0ocjOojKaJ0HmuWQvqIzNsNpEDUsLWh6PDO3S8GC1/IZfAf7Jke8
 8w6kSrFD2sCI4GIO3P0YknUMUccVF1YIRw79zExItFvcAJkQ2+16i8CoYdjOvG2elOhv
 AptqAz198N73tu8tbEdggT8/y9pNZtxiHhACYEQlmHbK7/TSrLFXyGxCww2GDocpQ/Xm
 pQm7a6gBr0UwCS1Ydlp92sSbe2L03+sVSALuD3o8U3OsWzS1D/8d0umGJldWsTZ0furq
 haG0dHYbWuu9qDQjOf9bos4RDnnDeP8wWeTALP17HAoBIPPvS9UlA8Fw1da2+70HwnzM
 hM+Q==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1711713159; x=1712317959;
 h=references:to:cc:in-reply-to:date:subject:mime-version:message-id
 :from:sender:x-gm-message-state:from:to:cc:subject:date:message-id
 :reply-to;
 bh=OBylIq5aIReUeJMgDsgysa+ZrwZbh8pep2+zpJG/XiI=;
 b=CK6Yc7SR6cTV+RWjgCpXdFcxs6JWVs5G5bQ1ZDfmhDmPc0NyPRMQYt5+n1BBs1F/rB
 r3JSJcbzl1TjEd0zJxhbrBf+m3drdgiXkww8dbodrVca544lZON+M16/Xe0JFxYqlT7L
 pXxB0PPunRqrU0f0uFMUq7E0BNue/FEKr+2zufQlppsBOfrRjnvA0aAHqLLo4zcfg3/u
 ic5Ujs4NR3M8mJEIbCPM41aWXysDLm2mSSjxgBRxOC9S/5k/8BwCwaN5wJnKN8LFLH/I
 yGoE3e2YVPpIpCrQyXKvw1by1tstFoSG5Y+djbVsk1CKEvplJ3Xse9qMzPpmBemGQ9HH
 FmbA==
X-Forwarded-Encrypted: i=1;
 AJvYcCX2TuJIn0MAivejFo2lzKRviEMsBKUL6jIx62kcrtBFzp4Zd6CuX0ZEqlSKniQB/BQ2VUYMCyj6A8dDLO67Z+me2uOb5ZA=
X-Gm-Message-State: AOJu0YxYNeJznf1SP6Q9C2ksUiR+PLa7OhnMZfpxvz5smpuGxKU0O2ir
 8EAfk+z8RG8ENTdY+ZLADfZxHzQcCDmDxnrOdIpP1Cvb8LjZ25Bw
X-Google-Smtp-Source: AGHT+IGFqEY2DnUwjfJEEKGYpx4WMSuXldX2f6ez3u9alU8oP9tb7lS3nSNpm+R9Ux6yEj+KLIg9sA==
X-Received: by 2002:ac2:48ac:0:b0:513:e6db:5bee with SMTP id
 u12-20020ac248ac000000b00513e6db5beemr1485020lfg.64.1711713159271; 
 Fri, 29 Mar 2024 04:52:39 -0700 (PDT)
Received: from smtpclient.apple (c80-217-1-132.bredband.tele2.se.
 [80.217.1.132]) by smtp.gmail.com with ESMTPSA id
 i34-20020a0565123e2200b00515d24b4760sm175281lfv.257.2024.03.29.04.52.38
 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128);
 Fri, 29 Mar 2024 04:52:38 -0700 (PDT)
From: =?utf-8?Q?Mattias_Engdeg=C3=A5rd?= <mattias.engdegard@HIDDEN>
Message-Id: <46794723-8324-41DD-8A1F-C1206A8EAFC2@HIDDEN>
Content-Type: multipart/mixed;
 boundary="Apple-Mail=_1827E7F0-089F-4DA4-AFE2-E086A78FE7A3"
Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.120.0.1.15\))
Subject: Re: bug#69709: `sort` interface improvement and universal ordering
 predicate
Date: Fri, 29 Mar 2024 12:52:37 +0100
In-Reply-To: <87edbtnu8i.fsf@HIDDEN>
To: Daniel Mendler <mail@HIDDEN>
References: <D3DD6F8C-55EA-4602-8A8C-3CDD6252CBCB@HIDDEN>
 <86zfv6uqjn.fsf@HIDDEN> <4391448A-C7AF-4D7F-8866-C0313956D52D@HIDDEN>
 <8366111E-97C4-4839-AA1E-A577C81A6035@HIDDEN>
 <bdfec2fb-8dfa-4222-8e6d-564dbd5cb982@HIDDEN>
 <4B7ACA81-DEB9-4878-BE0B-88A302AF7081@HIDDEN>
 <e1d5cc5c-c15d-4c61-bead-80794040ab1f@HIDDEN>
 <jwvmsqo7lwl.fsf-monnier+emacs@HIDDEN>
 <d619f326-21c8-4d6e-88bc-5d87cda18507@HIDDEN>
 <jwvsf0g5y8c.fsf-monnier+emacs@HIDDEN>
 <2BB79019-C075-445C-A9E0-9D29929EA02A@HIDDEN>
 <7219B5AB-4EA7-4050-92AE-7FB949D6D415@HIDDEN>
 <87edbtnu8i.fsf@HIDDEN>
X-Mailer: Apple Mail (2.3654.120.0.1.15)
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 69709
Cc: 69709 <at> debbugs.gnu.org, Dmitry Gutov <dmitry@HIDDEN>,
 Eli Zaretskii <eliz@HIDDEN>,
 =?utf-8?Q?Gerd_M=C3=B6llmann?= <gerd.moellmann@HIDDEN>,
 Stefan Monnier <monnier@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)


--Apple-Mail=_1827E7F0-089F-4DA4-AFE2-E086A78FE7A3
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;
	charset=us-ascii

29 mars 2024 kl. 12.38 skrev Daniel Mendler <mail@HIDDEN>:

> I would
> like to back-port the new feature in the Compat library, specifically =
in
> the emacs-30 branch of the Compat repository. I've seen you mentioned
> some pure Lisp code, implementing the new feature, in a slower, but
> backward compatible way, which we could perhaps use?

Here is my proof-of-concept hack that maybe you could use as starting =
point. It's incomplete but I think you can fill in the blanks. You could =
use the tests in fns-tests.el, perhaps adapted to fit. Let us know how =
it goes.


--Apple-Mail=_1827E7F0-089F-4DA4-AFE2-E086A78FE7A3
Content-Disposition: attachment;
	filename=compatsort.el
Content-Type: application/octet-stream;
	x-unix-mode=0644;
	name="compatsort.el"
Content-Transfer-Encoding: 7bit

;;; -*- lexical-binding: t -*-

;; Quick-and-dirty compat backport of Emacs 30 `sort' keyword args to
;; older versions

(defun value< (a b)
  "Cheapo Lisp impl of Emacs 30 `value<'."
  (cond
   ((numberp a) (< a b))
   ((stringp a) (string< a b))
   ((symbolp a)
    (or (and (null a) (consp b))
        (string< a b)))
   ((consp a)
    (while (and (consp b) (equal (car a) (car b)))
      (setq a (cdr a))
      (setq b (cdr b)))
    (if (consp a)
        (if (consp b)
            (value< (car a) (car b))
          (if b
              (error "value< type mismatch: %S %S" a b)
            nil))
      (value< a b)))
   ((vectorp a)
    (if (vectorp b)
        (let* ((na (length a))
               (nb (length b))
               (n (min na nb))
               (i 0))
          (while (and (< i n) (equal (aref a i) (aref b i)))
            (setq i (1+ i)))
          (if (< i n)
              (value< (aref a i) (aref b i))
            (< n nb)))
      (error "value< type mismatch: %S %S" a b)))
   ;; FIXME: records, markers, buffers, processes, bool-vectors
   (t (if (eq (type-of a) (type-of b))
          nil
        (error "value< type mismatch: %S %S" a b)))))

(defun sort-30 (seq key lessp reverse in-place)
  (unless lessp
    (setq lessp #'value<))
  ;; careful, can't just assign to lessp here -- use a new binding
  (let ((new-lessp
         (if key
             ;; FIXME: this is a bit inefficient if `key' is expensive
             (lambda (a b) (funcall lessp (funcall key a) (funcall key b)))
           lessp)))
    (unless in-place
      (setq seq (copy-sequence seq)))
    ;; FIXME: this is actually not quite correct when sorting lists
    ;; in-place -- we should really update the original list.
    (if reverse
        (nreverse (sort (if in-place (nreverse seq) (reverse seq))
                        new-lessp))
      (sort seq new-lessp))))

(defun sort-compat-transformer (form &rest args)
  "Compiler macro for `sort' that takes Emacs 30 keyword args."
  (let ((nargs (length args)))
    (if (zerop (% nargs 2))
        form                    ; old syntax, or error -- no transform
      ;; new syntax
      (let ((seq (car args))
            (key nil)
            (in-place nil)
            (reverse nil)
            (lessp nil))
        (setq args (cdr args))
        (while (cdr args)
          (let ((kw (car args))
                (val (cadr args)))
            (pcase kw
              (:key (setq key val))
              (:lessp (setq lessp val))
              (:reverse (setq reverse val))
              (:in-place (setq in-place val))
              (_ (error "bad `sort' keyword `%s'" kw))))
          (setq args (cddr args)))
        `(sort-30 ,seq ,key ,lessp ,reverse ,in-place)))))
    
(put 'sort 'compiler-macro 'sort-compat-transformer)

--Apple-Mail=_1827E7F0-089F-4DA4-AFE2-E086A78FE7A3--




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#69709; Package emacs. Full text available.

Message received at 69709 <at> debbugs.gnu.org:


Received: (at 69709) by debbugs.gnu.org; 29 Mar 2024 11:38:33 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Mar 29 07:38:33 2024
Received: from localhost ([127.0.0.1]:41809 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1rqAZ6-000497-QC
	for submit <at> debbugs.gnu.org; Fri, 29 Mar 2024 07:38:33 -0400
Received: from server.qxqx.de ([2a01:4f8:c012:9177::1]:49027 helo=mail.qxqx.de)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <mail@HIDDEN>) id 1rqAZ3-00048s-VX
 for 69709 <at> debbugs.gnu.org; Fri, 29 Mar 2024 07:38:30 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
 d=daniel-mendler.de; s=key; h=Content-Transfer-Encoding:Content-Type:
 MIME-Version:Message-ID:Date:References:In-Reply-To:Subject:Cc:To:From:Sender
 :Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:
 Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:
 List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=Vt9VGwD+6686wM9D9KWFAKZsF+F5fFdFsiFl0VDAkUY=; b=xZu1P4PkRedY7yg1wtyUllG4io
 dPZ1qcUYQkps+1kQ30AtL02dT7DJJlSvMywS0OC+ip+m3ziBhEcabiRXLzpqa7j4z0oDRZxYanlco
 +BgdWjs99yzt32zpq5H+Lil0S0pSpp1C95Gp6uX1r/HFV0lQBWpsCyfukiZpIL2F9eI4=;
From: Daniel Mendler <mail@HIDDEN>
To: Mattias =?utf-8?Q?Engdeg=C3=A5rd?= <mattias.engdegard@HIDDEN>
Subject: Re: bug#69709: `sort` interface improvement and universal ordering
 predicate
In-Reply-To: <7219B5AB-4EA7-4050-92AE-7FB949D6D415@HIDDEN> ("Mattias
 =?utf-8?Q?Engdeg=C3=A5rd=22's?= message of "Fri, 29 Mar 2024 11:59:39
 +0100")
References: <D3DD6F8C-55EA-4602-8A8C-3CDD6252CBCB@HIDDEN>
 <86zfv6uqjn.fsf@HIDDEN>
 <4391448A-C7AF-4D7F-8866-C0313956D52D@HIDDEN>
 <8366111E-97C4-4839-AA1E-A577C81A6035@HIDDEN>
 <bdfec2fb-8dfa-4222-8e6d-564dbd5cb982@HIDDEN>
 <4B7ACA81-DEB9-4878-BE0B-88A302AF7081@HIDDEN>
 <e1d5cc5c-c15d-4c61-bead-80794040ab1f@HIDDEN>
 <jwvmsqo7lwl.fsf-monnier+emacs@HIDDEN>
 <d619f326-21c8-4d6e-88bc-5d87cda18507@HIDDEN>
 <jwvsf0g5y8c.fsf-monnier+emacs@HIDDEN>
 <2BB79019-C075-445C-A9E0-9D29929EA02A@HIDDEN>
 <7219B5AB-4EA7-4050-92AE-7FB949D6D415@HIDDEN>
Date: Fri, 29 Mar 2024 12:38:21 +0100
Message-ID: <87edbtnu8i.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 69709
Cc: 69709 <at> debbugs.gnu.org, Dmitry Gutov <dmitry@HIDDEN>,
 Eli Zaretskii <eliz@HIDDEN>,
 Gerd =?utf-8?Q?M=C3=B6llmann?= <gerd.moellmann@HIDDEN>,
 Stefan Monnier <monnier@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Mattias Engdeg=C3=A5rd <mattias.engdegard@HIDDEN> writes:

> 25 mars 2024 kl. 12.11 skrev Mattias Engdeg=C3=A5rd <mattias.engdegard@gm=
ail.com>:
>
>> The plan is to add scratch/sort-key to master in a few days if no seriou=
s issues turn up.
>
> Plan executed.

Thank you for this excellent improvement of the sort function! I would
like to back-port the new feature in the Compat library, specifically in
the emacs-30 branch of the Compat repository. I've seen you mentioned
some pure Lisp code, implementing the new feature, in a slower, but
backward compatible way, which we could perhaps use?

Daniel




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#69709; Package emacs. Full text available.

Message received at 69709 <at> debbugs.gnu.org:


Received: (at 69709) by debbugs.gnu.org; 29 Mar 2024 10:59:55 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Mar 29 06:59:55 2024
Received: from localhost ([127.0.0.1]:41782 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1rq9xi-00083k-OG
	for submit <at> debbugs.gnu.org; Fri, 29 Mar 2024 06:59:54 -0400
Received: from mail-lj1-x22a.google.com ([2a00:1450:4864:20::22a]:51461)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <mattias.engdegard@HIDDEN>) id 1rq9xd-00083T-00
 for 69709 <at> debbugs.gnu.org; Fri, 29 Mar 2024 06:59:53 -0400
Received: by mail-lj1-x22a.google.com with SMTP id
 38308e7fff4ca-2d29aad15a5so21229931fa.3
 for <69709 <at> debbugs.gnu.org>; Fri, 29 Mar 2024 03:59:47 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1711709981; x=1712314781; 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=bSN5nGqd7mu/5M6zoisWkRZWtY+r61yJIVzPAmoPNvQ=;
 b=GMyh8zfRgc4TZCcJVnJjW0xkl6mtc1bN5s4Qy+NGDKFPIUMQ+JFptGZwBa7bMiYnXI
 PNezxGH4MjvI4yMZNJu2XUV4vvywBq6Um+aQsIRJmWGlP7+/tzd9ozwtCVNjcOjwFgmu
 /9zmk5a6Lqft7OJBrkoIc4lE8UzciXMSsmOpS1BbsK05Sb/PyIRhK7V/R7ISREwR1qmw
 ZFerwmOT2c85xCaSuvR7qe7qFLQqXPoCET0wCEbLpvEN8omgJq/Jq1G3spU2JIX5OCn1
 D5LDZE+oj5En8Gh9EXHQUL2+nY7oyuAB6d+ugmKgWlhsGoOMTD5gIb5ZWPhcjPAqQ3Or
 +jKw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1711709981; x=1712314781;
 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=bSN5nGqd7mu/5M6zoisWkRZWtY+r61yJIVzPAmoPNvQ=;
 b=jKIGvORsONGlSj1xX7fT+ZezBUWEnUwKyhcQdsrXSD0ds3wkMbmGhScHO1uq10LG0V
 8lHokZwkggSNkd6hTgF2Ir+75DzwWCN6WKkN/RtPrXrrahkK1pY1z3fYoAblKgekiEX1
 /2P6iyWTMQyn4tayobvCqQ1iPc43lviz5OXU2boxWOcP0qH+q6JnyvIhNiwcnzxxgPjD
 j+zlZX1cHsR74cRNI34N5kVLDTzyS01pa3O1i/eir3XV5+pIZzS12+IxVS8eKDMfPJuW
 z1ubIbEWU7tBeKGyPIc3XDfAzH8QjJed4xLOJN3KWed6dYD2XpAYHGVLg0G/ojXb71Jy
 svPQ==
X-Forwarded-Encrypted: i=1;
 AJvYcCVjkeyrHhi3bCJ3HbuHDCkjvsTJ4+VqadjHy8CQNuWN2WmY2QIPKGyPTAXhJxZ4YUY+m3lrY5iq3BgZEoK5O2MWNrU8yCY=
X-Gm-Message-State: AOJu0YwGTHidvbX0XDhUmAlTrfOMqDqGDVvdCD4jBfIYCPvSWPEIHnve
 e+VUE+1uCbcHQ1KwMe9W0QRzFTJRXwtBZ+jEp4HtziUa0L1sy4MM
X-Google-Smtp-Source: AGHT+IGDYtPzTZSlxUsPyNniFnd+hjfRB/7pb9q5wlpYPLhVReIZh1i/HYRjMw6/Ew5erEjy1Q+DzQ==
X-Received: by 2002:a2e:bc21:0:b0:2d6:a699:4bae with SMTP id
 b33-20020a2ebc21000000b002d6a6994baemr1367576ljf.6.1711709980926; 
 Fri, 29 Mar 2024 03:59:40 -0700 (PDT)
Received: from smtpclient.apple (c80-217-1-132.bredband.tele2.se.
 [80.217.1.132]) by smtp.gmail.com with ESMTPSA id
 y23-20020a2e9797000000b002d6b678ae61sm602318lji.70.2024.03.29.03.59.40
 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128);
 Fri, 29 Mar 2024 03:59:40 -0700 (PDT)
Content-Type: text/plain;
	charset=utf-8
Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.120.0.1.15\))
Subject: Re: bug#69709: `sort` interface improvement and universal ordering
 predicate
From: =?utf-8?Q?Mattias_Engdeg=C3=A5rd?= <mattias.engdegard@HIDDEN>
In-Reply-To: <2BB79019-C075-445C-A9E0-9D29929EA02A@HIDDEN>
Date: Fri, 29 Mar 2024 11:59:39 +0100
Content-Transfer-Encoding: quoted-printable
Message-Id: <7219B5AB-4EA7-4050-92AE-7FB949D6D415@HIDDEN>
References: <D3DD6F8C-55EA-4602-8A8C-3CDD6252CBCB@HIDDEN>
 <86zfv6uqjn.fsf@HIDDEN> <4391448A-C7AF-4D7F-8866-C0313956D52D@HIDDEN>
 <8366111E-97C4-4839-AA1E-A577C81A6035@HIDDEN>
 <bdfec2fb-8dfa-4222-8e6d-564dbd5cb982@HIDDEN>
 <4B7ACA81-DEB9-4878-BE0B-88A302AF7081@HIDDEN>
 <e1d5cc5c-c15d-4c61-bead-80794040ab1f@HIDDEN>
 <jwvmsqo7lwl.fsf-monnier+emacs@HIDDEN>
 <d619f326-21c8-4d6e-88bc-5d87cda18507@HIDDEN>
 <jwvsf0g5y8c.fsf-monnier+emacs@HIDDEN>
 <2BB79019-C075-445C-A9E0-9D29929EA02A@HIDDEN>
To: Stefan Monnier <monnier@HIDDEN>
X-Mailer: Apple Mail (2.3654.120.0.1.15)
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 69709
Cc: 69709 <at> debbugs.gnu.org, Dmitry Gutov <dmitry@HIDDEN>,
 Eli Zaretskii <eliz@HIDDEN>,
 =?utf-8?Q?Gerd_M=C3=B6llmann?= <gerd.moellmann@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

25 mars 2024 kl. 12.11 skrev Mattias Engdeg=C3=A5rd =
<mattias.engdegard@HIDDEN>:

> The plan is to add scratch/sort-key to master in a few days if no =
serious issues turn up.

Plan executed.





Information forwarded to bug-gnu-emacs@HIDDEN:
bug#69709; Package emacs. Full text available.

Message received at 69709 <at> debbugs.gnu.org:


Received: (at 69709) by debbugs.gnu.org; 25 Mar 2024 16:37:29 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Mar 25 12:37:29 2024
Received: from localhost ([127.0.0.1]:36037 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1ronKC-00024e-NF
	for submit <at> debbugs.gnu.org; Mon, 25 Mar 2024 12:37:28 -0400
Received: from mail-lj1-x230.google.com ([2a00:1450:4864:20::230]:57369)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <mattias.engdegard@HIDDEN>) id 1ronK9-00024R-SJ
 for 69709 <at> debbugs.gnu.org; Mon, 25 Mar 2024 12:37:27 -0400
Received: by mail-lj1-x230.google.com with SMTP id
 38308e7fff4ca-2d6c220a377so25878381fa.2
 for <69709 <at> debbugs.gnu.org>; Mon, 25 Mar 2024 09:37:26 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1711384640; x=1711989440; 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=WY15nKcOU0SZXtXpsQmXJ655QrdRV6OSagHXYtRezzI=;
 b=UtdAudDIzevICXi0/R3k2rQmGg3D1ZB7DGqEZANidjqO3WluwpRRX3Rl3f4SQxTerm
 sLGrUyQwPLEs7NBkWnPTYJv/9PDlnV033ECTofXQz/mykSBToUKwmp0Hf/Jk6DpIa1BE
 Y2ozWCWa7IfkE9pSW3YGc2X3nATLANVHIp+ruJz0qaBK5kDorA6tc8rYtPZH5XdQZtbP
 1Dgfcb54PCQ9rdNnzRRUVs6FiczAF6MK9P+IO/F6hR3pWWJCSjJGF1vf+qV69X8C5XHP
 qulbfgIZ5w3ESgV2g+UAjn7sSXs+iFr3c+rJ+qwt/VyevULNHg1fPzw2vofUzdoGnJb2
 HVgg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1711384640; x=1711989440;
 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=WY15nKcOU0SZXtXpsQmXJ655QrdRV6OSagHXYtRezzI=;
 b=BdBYhZp4x/NJ1zHhVMr6X3z2GODUi+Phy7DQOvIgcV9U0BM4hnkYGLbh+Ytf6lZJ2u
 tRc3ovLqWYzGBRvKW9tjSzRN7nGXmCL3tqTUGPBxeF+9gK2p+EV9LN6cKK4QJvLsplFf
 uRdyUH8utEa/gy6a/p+lM1k3TfmJTvODMSkAwfmPL8seXk8weefnyGDC0VKDEY1lbXeL
 f+aCh+Nnf62Z592uCsUJ9kUNR/5ajR6KX1JNw7tJwmIGN2W95IVHGjevR2YJlazxrp05
 ck5J131PC/9+LJVNt++NbxxyDUxIsmiPkldk9/3JraSaHgcHGUef/6xARQiadbnpD1eO
 aCCQ==
X-Forwarded-Encrypted: i=1;
 AJvYcCXlThGUOhF4RhCE1zFJSOPTWb8NKFqmvwfzum9ZDfcZR5Nonyx74vEEWR09IOPFYIz/fV1VSg2OyS58P1Z2Kbes9Sp4VVs=
X-Gm-Message-State: AOJu0Yxq0djzqNpvZR+qQhhOV1tf1/1hVDxZogqFPaAFw8YYolJ9xSrS
 2VrqGuTc41NZwU9JDqNGemk5Wh8uKTJkb3EU4QZEduOzeJq4Bwn/n+dF4Op9
X-Google-Smtp-Source: AGHT+IEOHbXP/Md9bRzjuNFQ+cmC6/AtbX02+VgZjVtThZ+77VDjrHOskUVKiOgBPx/n6vugMUnNlw==
X-Received: by 2002:a05:6512:3b9:b0:513:80b3:3eea with SMTP id
 v25-20020a05651203b900b0051380b33eeamr4265707lfp.56.1711365120837; 
 Mon, 25 Mar 2024 04:12:00 -0700 (PDT)
Received: from smtpclient.apple (c80-217-1-132.bredband.tele2.se.
 [80.217.1.132]) by smtp.gmail.com with ESMTPSA id
 g27-20020ac24d9b000000b00513c86486b5sm1030220lfe.6.2024.03.25.04.11.58
 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128);
 Mon, 25 Mar 2024 04:11:59 -0700 (PDT)
Content-Type: text/plain;
	charset=us-ascii
Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.120.0.1.15\))
Subject: Re: bug#69709: `sort` interface improvement and universal ordering
 predicate
From: =?utf-8?Q?Mattias_Engdeg=C3=A5rd?= <mattias.engdegard@HIDDEN>
In-Reply-To: <jwvsf0g5y8c.fsf-monnier+emacs@HIDDEN>
Date: Mon, 25 Mar 2024 12:11:57 +0100
Content-Transfer-Encoding: quoted-printable
Message-Id: <2BB79019-C075-445C-A9E0-9D29929EA02A@HIDDEN>
References: <D3DD6F8C-55EA-4602-8A8C-3CDD6252CBCB@HIDDEN>
 <86zfv6uqjn.fsf@HIDDEN> <4391448A-C7AF-4D7F-8866-C0313956D52D@HIDDEN>
 <8366111E-97C4-4839-AA1E-A577C81A6035@HIDDEN>
 <bdfec2fb-8dfa-4222-8e6d-564dbd5cb982@HIDDEN>
 <4B7ACA81-DEB9-4878-BE0B-88A302AF7081@HIDDEN>
 <e1d5cc5c-c15d-4c61-bead-80794040ab1f@HIDDEN>
 <jwvmsqo7lwl.fsf-monnier+emacs@HIDDEN>
 <d619f326-21c8-4d6e-88bc-5d87cda18507@HIDDEN>
 <jwvsf0g5y8c.fsf-monnier+emacs@HIDDEN>
To: Stefan Monnier <monnier@HIDDEN>
X-Mailer: Apple Mail (2.3654.120.0.1.15)
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 69709
Cc: 69709 <at> debbugs.gnu.org, Dmitry Gutov <dmitry@HIDDEN>,
 Eli Zaretskii <eliz@HIDDEN>,
 =?utf-8?Q?Gerd_M=C3=B6llmann?= <gerd.moellmann@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

24 mars 2024 kl. 00.25 skrev Stefan Monnier <monnier@HIDDEN>:

> When it matters, people can use `:in-place`.

Indeed, we follow the policy of being safe by default with a faster, =
more dangerous alternative on explicit request: `reverse` vs `nreverse`, =
for instance.

I'm quite happy with the result overall: safer, much easier to use, and =
faster, all at the same time. Many of the uses of `sort` in the Emacs =
tree would have benefitted a lot from the new design, especially the =
hand-written lambda monstrosities that try to implement multi-key =
comparisons.

It should also be quite feasible to supply a working (but slower) =
all-Lisp implementation for the `compat` package; I have some basic =
proof-of-concept code.

The plan is to add scratch/sort-key to master in a few days if no =
serious issues turn up. There are a few minor adjustments to the =
documentation that haven't been pushed yet.

Oh, and the embarrassing code in `value<` for comparing bool-vectors has =
now been sped up ~150x in my tree, if you were worried about that.





Information forwarded to bug-gnu-emacs@HIDDEN:
bug#69709; Package emacs. Full text available.

Message received at 69709 <at> debbugs.gnu.org:


Received: (at 69709) by debbugs.gnu.org; 23 Mar 2024 23:26:47 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Mar 23 19:26:47 2024
Received: from localhost ([127.0.0.1]:32787 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1roAlC-0001a7-Sb
	for submit <at> debbugs.gnu.org; Sat, 23 Mar 2024 19:26:47 -0400
Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:6546)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <monnier@HIDDEN>) id 1roAlB-0001Zd-5d
 for 69709 <at> debbugs.gnu.org; Sat, 23 Mar 2024 19:26:46 -0400
Received: from pmg3.iro.umontreal.ca (localhost [127.0.0.1])
 by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 5F6E3441005;
 Sat, 23 Mar 2024 19:25:57 -0400 (EDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca;
 s=mail; t=1711236356;
 bh=RyevMyJgf+ToTS8P6czEEi025inmIQRvH6k6e9XTPgI=;
 h=From:To:Cc:Subject:In-Reply-To:References:Date:From;
 b=BVShTpe4iBNEGZod9HBpiyA3qviOrvx87INnjsy9RCpTpxladfjOTBRm85pd32+Of
 omfQXqLF8ZmTn607RWOeZV/Su20wPV2agzWW6CjrXvwP8MJPLTV9vxbFlguHWpbIoa
 2UOr/1mTArreeQLz96kYRGXJslheCCR25ixz/X0cOvAq6ZQxdBwX08Tu3JJh1uH0/o
 z0Kt2qFQXlYPitmdpDJll8XKY6OVsQLFff8FnH69sSQy8u0V+iCv1ErGrVaFad0yv9
 m923YGhsFQUnxb1raWSY+w+RfjTStoun4BFjD4XvuDBxPLXBLy+SSMVw9RFLhQBEiN
 KKt769ySxN+gA==
Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1])
 by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 3002F440FF2;
 Sat, 23 Mar 2024 19:25:56 -0400 (EDT)
Received: from alfajor (unknown [104.247.238.200])
 by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id ED7CC12072D;
 Sat, 23 Mar 2024 19:25:55 -0400 (EDT)
From: Stefan Monnier <monnier@HIDDEN>
To: Dmitry Gutov <dmitry@HIDDEN>
Subject: Re: bug#69709: `sort` interface improvement and universal ordering
 predicate
In-Reply-To: <d619f326-21c8-4d6e-88bc-5d87cda18507@HIDDEN> (Dmitry Gutov's
 message of "Sun, 24 Mar 2024 01:19:09 +0200")
Message-ID: <jwvsf0g5y8c.fsf-monnier+emacs@HIDDEN>
References: <D3DD6F8C-55EA-4602-8A8C-3CDD6252CBCB@HIDDEN>
 <86zfv6uqjn.fsf@HIDDEN>
 <4391448A-C7AF-4D7F-8866-C0313956D52D@HIDDEN>
 <8366111E-97C4-4839-AA1E-A577C81A6035@HIDDEN>
 <bdfec2fb-8dfa-4222-8e6d-564dbd5cb982@HIDDEN>
 <4B7ACA81-DEB9-4878-BE0B-88A302AF7081@HIDDEN>
 <e1d5cc5c-c15d-4c61-bead-80794040ab1f@HIDDEN>
 <jwvmsqo7lwl.fsf-monnier+emacs@HIDDEN>
 <d619f326-21c8-4d6e-88bc-5d87cda18507@HIDDEN>
Date: Sat, 23 Mar 2024 19:25:54 -0400
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain
X-SPAM-INFO: Spam detection results:  0
 ALL_TRUSTED                -1 Passed through trusted hosts only via SMTP
 AWL -0.412 Adjusted score from AWL reputation of From: address
 BAYES_00                 -1.9 Bayes spam probability is 0 to 1%
 DKIM_SIGNED               0.1 Message has a DKIM or DK signature,
 not necessarily valid
 DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature
 DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's
 domain
 DKIM_VALID_EF -0.1 Message has a valid DKIM or DK signature from envelope-from
 domain
X-SPAM-LEVEL: 
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 69709
Cc: 69709 <at> debbugs.gnu.org,
 Gerd =?windows-1252?Q?M=F6llmann?= <gerd.moellmann@HIDDEN>,
 Mattias =?windows-1252?Q?Engdeg=E5rd?= <mattias.engdegard@HIDDEN>,
 Eli Zaretskii <eliz@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> IIUC we allocate an array internally as well during the sorting phrase, but
> then we can't return it as-is or with a thin wrapper (if only because the
> user expects back a list, not a vector), so we'll need to allocate a whole
> new list to avoid mutating the original. And our GC is worse than JVM's.

When it matters, people can use `:in-place`.


        Stefan





Information forwarded to bug-gnu-emacs@HIDDEN:
bug#69709; Package emacs. Full text available.

Message received at 69709 <at> debbugs.gnu.org:


Received: (at 69709) by debbugs.gnu.org; 23 Mar 2024 23:20:05 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Mar 23 19:20:05 2024
Received: from localhost ([127.0.0.1]:60678 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1roAei-0001HR-TN
	for submit <at> debbugs.gnu.org; Sat, 23 Mar 2024 19:20:05 -0400
Received: from wout5-smtp.messagingengine.com ([64.147.123.21]:52939)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <dmitry@HIDDEN>) id 1roAeg-0001Gc-Cu
 for 69709 <at> debbugs.gnu.org; Sat, 23 Mar 2024 19:20:03 -0400
Received: from compute6.internal (compute6.nyi.internal [10.202.2.47])
 by mailout.west.internal (Postfix) with ESMTP id 599113200A14;
 Sat, 23 Mar 2024 19:19:14 -0400 (EDT)
Received: from mailfrontend2 ([10.202.2.163])
 by compute6.internal (MEProxy); Sat, 23 Mar 2024 19:19:14 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gutov.dev; h=cc
 :cc:content-transfer-encoding:content-type:content-type:date
 :date:from:from:in-reply-to:in-reply-to:message-id:mime-version
 :references:reply-to:subject:subject:to:to; s=fm3; t=1711235953;
 x=1711322353; bh=5XP1Lp8MMWaMHNAGkwvC1pCDkEuPTrNSPkaJLEoJQ6I=; b=
 gDR4I+nC4kxjLH1Fc8JhmBtrLnPtEdquraCBK9+0TyV8OAoH6cVJPIO1Qc63/waz
 SWXLv28H4YTCtyKhMxmxuKPTVvVbnxz1jm5tO1Pe96WZCbBqNsv+KEiWk8TaBTmv
 I+wJJA39DSrbJIHKuu3Ca0p19Y9J1DQG/AJUURavrIMjyiw3H06eCp1Tp/gz2+PO
 pp/GmL4gRMHTrFpb0I7E4w0ke6qMYDZS7F5uL83uF4QlJ7b6h7VbLUXIijjogZgu
 i3IHSh64jIQewYeslkRwVMmCU0H9TAIgA506B2MGGVcseRaDixYiKxmbcnTR5zmV
 7kSFEYHSisgbTjgTKZiApA==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=
 messagingengine.com; h=cc:cc:content-transfer-encoding
 :content-type:content-type:date:date:feedback-id:feedback-id
 :from:from:in-reply-to:in-reply-to:message-id:mime-version
 :references:reply-to:subject:subject:to:to:x-me-proxy:x-me-proxy
 :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t=1711235953; x=
 1711322353; bh=5XP1Lp8MMWaMHNAGkwvC1pCDkEuPTrNSPkaJLEoJQ6I=; b=w
 /8rJxYsu4yiLkhvyjtfRZCwKiFC9rQGT4kAZrxw3MoaftkkJjkUffGY2RXEYxYaJ
 YaU76f34kBXX57NlHFJmy9Ou58yBq1xeRhmQiaVCSyKJAWrM+juuiYhAE0Z0P4/Q
 QTcejzTfo4PWI8sJohVvSe3OkaW2ccfgblYXmxZyXe9HcsjHSNQ1xDuAFn2TCSWt
 RsfDD3ZiEH6o3vvTLGSOMGQz73hagSsTK22hOqEvCFzh0N9esVJ6mPgk3TtTZRq/
 KC8xx/SeGjv2tsWklG1ydvnU6pSK2zMZOqiw5JPLrAgQi8MK6BLaOi+mRrGytfCo
 D+s0vyzXfnElowYMBkH5w==
X-ME-Sender: <xms:cWP_ZdUolA1bGGAlcXJY6WCMefNeOTdom3xBk8M5qquEEDLpZ12gtQ>
 <xme:cWP_ZdncFocpotNLE8-EKrLJ8zqsN_tPldyIC32uHX0bRHlhaQL_BfX5oLhhkB7Tp
 6s5_VB02wAR3-_Z9sc>
X-ME-Received: <xmr:cWP_ZZZWk8zNNioET62vANWQ-lGPpevS-tXaS6CjEJVCOKOrBBKkKyvfr5V1X6hdZVnZ>
X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledruddthedgtdelucetufdoteggodetrfdotf
 fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen
 uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne
 cujfgurhepkfffgggfuffvvehfhfgjtgfgsehtjeertddtvdejnecuhfhrohhmpeffmhhi
 thhrhicuifhuthhovhcuoegumhhithhrhiesghhuthhovhdruggvvheqnecuggftrfgrth
 htvghrnhepfeekheeuteeigeevledtjeefheefheehjeehkeeuhfeffeelveffleehfefh
 vdevnecuffhomhgrihhnpehgihhthhhusgdrtghomhenucevlhhushhtvghrufhiiigvpe
 dtnecurfgrrhgrmhepmhgrihhlfhhrohhmpegumhhithhrhiesghhuthhovhdruggvvh
X-ME-Proxy: <xmx:cWP_ZQUOsqVcBjvWiLJCldZOdf5yprfDvIJ_34WEJHi6gBoOBOWb1g>
 <xmx:cWP_ZXk6SATrC-eosiUbcFVUa4cUrjLsI9NLmtX4n0K9Fj2lfi4X7A>
 <xmx:cWP_Zdc3vA1IxD-oR1s5Lomy3IH7PyQO6ESiXGJuC5rKXjDQhSSSOQ>
 <xmx:cWP_ZRGCIFJIWCBuxxwm_imAqFbGipKRJJheoP3Nj-WIyEZEcXo2tw>
 <xmx:cWP_ZQDiX3csjTX3O6HSjV7gFqTvLirxvlnfKAC4EuQKncotrNcgMA>
Feedback-ID: i0e71465a:Fastmail
Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sat,
 23 Mar 2024 19:19:12 -0400 (EDT)
Message-ID: <d619f326-21c8-4d6e-88bc-5d87cda18507@HIDDEN>
Date: Sun, 24 Mar 2024 01:19:09 +0200
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
Subject: Re: bug#69709: `sort` interface improvement and universal ordering
 predicate
Content-Language: en-US
To: Stefan Monnier <monnier@HIDDEN>
References: <D3DD6F8C-55EA-4602-8A8C-3CDD6252CBCB@HIDDEN>
 <86zfv6uqjn.fsf@HIDDEN> <4391448A-C7AF-4D7F-8866-C0313956D52D@HIDDEN>
 <8366111E-97C4-4839-AA1E-A577C81A6035@HIDDEN>
 <bdfec2fb-8dfa-4222-8e6d-564dbd5cb982@HIDDEN>
 <4B7ACA81-DEB9-4878-BE0B-88A302AF7081@HIDDEN>
 <e1d5cc5c-c15d-4c61-bead-80794040ab1f@HIDDEN>
 <jwvmsqo7lwl.fsf-monnier+emacs@HIDDEN>
From: Dmitry Gutov <dmitry@HIDDEN>
In-Reply-To: <jwvmsqo7lwl.fsf-monnier+emacs@HIDDEN>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 69709
Cc: 69709 <at> debbugs.gnu.org,
 =?UTF-8?Q?Gerd_M=C3=B6llmann?= <gerd.moellmann@HIDDEN>,
 =?UTF-8?Q?Mattias_Engdeg=C3=A5rd?= <mattias.engdegard@HIDDEN>,
 Eli Zaretskii <eliz@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

On 23/03/2024 22:09, Stefan Monnier wrote:
>> So others will have to go around each such project, ensure the original list
>> is "owned" and add the :in-place argument, to reach the optimum
>> performance. That's why, I think, 'sort' is mutating in most languages.
> I think it's mutating in "most languages" because "most languages" are
> imperative and because those primitives usually operate on arrays (a
> "naturally imperative" data structure) rather than on singly-linked
> lists (a "naturally more immutable" data structure).

There aren't many general purpose languages around which use cons cells 
and have 'sort' in stdlib for them, to compare.

To get back to the example of Clojure, which touts immutability most of 
the time, the 'sort' routine first copies a sequence into an array 
(apparently for performance - fewer indirections and better locality 
when subsequently swapping values around), and then returns that array 
with a thin wrapper called ArraySeq (which it 1 extra object, not N).

https://github.com/clojure/clojure/blob/ce55092f2b2f5481d25cff6205470c1335760ef6/src/clj/clojure/core.clj#L3103-L3118

IIUC we allocate an array internally as well during the sorting phrase, 
but then we can't return it as-is or with a thin wrapper (if only 
because the user expects back a list, not a vector), so we'll need to 
allocate a whole new list to avoid mutating the original. And our GC is 
worse than JVM's.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#69709; Package emacs. Full text available.

Message received at 69709 <at> debbugs.gnu.org:


Received: (at 69709) by debbugs.gnu.org; 23 Mar 2024 20:10:08 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Mar 23 16:10:08 2024
Received: from localhost ([127.0.0.1]:51084 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1ro7gu-0001V6-61
	for submit <at> debbugs.gnu.org; Sat, 23 Mar 2024 16:10:08 -0400
Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:9428)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <monnier@HIDDEN>) id 1ro7gr-0001UJ-9p
 for 69709 <at> debbugs.gnu.org; Sat, 23 Mar 2024 16:10:06 -0400
Received: from pmg3.iro.umontreal.ca (localhost [127.0.0.1])
 by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 1137C440FDC;
 Sat, 23 Mar 2024 16:09:18 -0400 (EDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca;
 s=mail; t=1711224556;
 bh=JwcIpeKVkxeYaBvpKYF/+WxKRjpF3eEqJHPmRC+LTUs=;
 h=From:To:Cc:Subject:In-Reply-To:References:Date:From;
 b=n2KZ2Krn+YX4OF0aRfFbV9YvRGP0Cvbm7U7s1LAoBoKo14rCynJBqJ0C9rGMCzpxO
 cn5Q01b9eent/1XVhr5HF6PW0SvyAsyTXItIV0XULpCkv1FTE1WVB5rNWAsm/BAyOE
 XfGtHSemZT3Ussz9FbnA2hbBTIWf5g1ZUzbgASDuSSRMKcb46Tfd2d8HDGbIXnN75w
 8uvaxSYyNmDM9HwgmkeuP7ejdvJSAaeSI7EDIYPnrMKbNHbxzBPZqe0eTYdFmBhBWi
 9ezvHyWRVOE/DQjtzNzJ1WKA1WEikUEE+3BtgTjXhkRu7AzGU7tSa4gTnUtxAzfbET
 HJ4mq+lvMOJxQ==
Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1])
 by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id C0A8C440FC2;
 Sat, 23 Mar 2024 16:09:16 -0400 (EDT)
Received: from pastel (unknown [104.247.238.200])
 by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 8FD1312068E;
 Sat, 23 Mar 2024 16:09:16 -0400 (EDT)
From: Stefan Monnier <monnier@HIDDEN>
To: Dmitry Gutov <dmitry@HIDDEN>
Subject: Re: bug#69709: `sort` interface improvement and universal ordering
 predicate
In-Reply-To: <e1d5cc5c-c15d-4c61-bead-80794040ab1f@HIDDEN> (Dmitry Gutov's
 message of "Sat, 23 Mar 2024 19:39:51 +0200")
Message-ID: <jwvmsqo7lwl.fsf-monnier+emacs@HIDDEN>
References: <D3DD6F8C-55EA-4602-8A8C-3CDD6252CBCB@HIDDEN>
 <86zfv6uqjn.fsf@HIDDEN>
 <4391448A-C7AF-4D7F-8866-C0313956D52D@HIDDEN>
 <8366111E-97C4-4839-AA1E-A577C81A6035@HIDDEN>
 <bdfec2fb-8dfa-4222-8e6d-564dbd5cb982@HIDDEN>
 <4B7ACA81-DEB9-4878-BE0B-88A302AF7081@HIDDEN>
 <e1d5cc5c-c15d-4c61-bead-80794040ab1f@HIDDEN>
Date: Sat, 23 Mar 2024 16:09:16 -0400
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain
X-SPAM-INFO: Spam detection results:  0
 ALL_TRUSTED                -1 Passed through trusted hosts only via SMTP
 AWL -0.371 Adjusted score from AWL reputation of From: address
 BAYES_00                 -1.9 Bayes spam probability is 0 to 1%
 DKIM_SIGNED               0.1 Message has a DKIM or DK signature,
 not necessarily valid
 DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature
 DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's
 domain
 DKIM_VALID_EF -0.1 Message has a valid DKIM or DK signature from envelope-from
 domain
X-SPAM-LEVEL: 
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 69709
Cc: 69709 <at> debbugs.gnu.org,
 Gerd =?windows-1252?Q?M=F6llmann?= <gerd.moellmann@HIDDEN>,
 Mattias =?windows-1252?Q?Engdeg=E5rd?= <mattias.engdegard@HIDDEN>,
 Eli Zaretskii <eliz@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> So others will have to go around each such project, ensure the original list
> is "owned" and add the :in-place argument, to reach the optimum
> performance. That's why, I think, 'sort' is mutating in most languages.

I think it's mutating in "most languages" because "most languages" are
imperative and because those primitives usually operate on arrays (a
"naturally imperative" data structure) rather than on singly-linked
lists (a "naturally more immutable" data structure).


        Stefan





Information forwarded to bug-gnu-emacs@HIDDEN:
bug#69709; Package emacs. Full text available.

Message received at 69709 <at> debbugs.gnu.org:


Received: (at 69709) by debbugs.gnu.org; 23 Mar 2024 17:40:49 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Mar 23 13:40:49 2024
Received: from localhost ([127.0.0.1]:42855 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1ro5MO-0003IT-VF
	for submit <at> debbugs.gnu.org; Sat, 23 Mar 2024 13:40:49 -0400
Received: from wout3-smtp.messagingengine.com ([64.147.123.19]:48989)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <dmitry@HIDDEN>) id 1ro5ML-0003I8-0a
 for 69709 <at> debbugs.gnu.org; Sat, 23 Mar 2024 13:40:47 -0400
Received: from compute2.internal (compute2.nyi.internal [10.202.2.46])
 by mailout.west.internal (Postfix) with ESMTP id 860DE3200A11;
 Sat, 23 Mar 2024 13:39:57 -0400 (EDT)
Received: from mailfrontend2 ([10.202.2.163])
 by compute2.internal (MEProxy); Sat, 23 Mar 2024 13:39:58 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gutov.dev; h=cc
 :cc:content-transfer-encoding:content-type:content-type:date
 :date:from:from:in-reply-to:in-reply-to:message-id:mime-version
 :references:reply-to:subject:subject:to:to; s=fm3; t=1711215597;
 x=1711301997; bh=l5Ggg79ag8TiqSQC+pOvaerCPbtGRgFnDQJKhZrcr+8=; b=
 dcx8rHgv5nSVPgbeFCHgouj7Nefu/zWDW3Gvu+lyy4F6Fv3IW238kCsQ/ihXLtJn
 AxaazA0L2sGHsz8jLqC0V0YXMPmdEVqGj0gqdjv7mjnEcUbjM9z37yVnCFGc3UHQ
 TdnqjLuv3naVYRBtGYjT+45EJBz5R61o21vhbY3GPaoQnxlngtl9FgF5zPyW9Nni
 nGvZep0zkiaTFRWldITa+gF+W0ZHeMN4O73iiPjmKp79V4TvHq1zn8JO7I5odydj
 8FlqJQ6hwkwBLqxAiJw2Kffz+hQL4QL4UJNhHGzq/d81g7mNnzWUGuxLnq5+oaEC
 d7cQdOFaq9y5CHXWq4OGow==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=
 messagingengine.com; h=cc:cc:content-transfer-encoding
 :content-type:content-type:date:date:feedback-id:feedback-id
 :from:from:in-reply-to:in-reply-to:message-id:mime-version
 :references:reply-to:subject:subject:to:to:x-me-proxy:x-me-proxy
 :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t=1711215597; x=
 1711301997; bh=l5Ggg79ag8TiqSQC+pOvaerCPbtGRgFnDQJKhZrcr+8=; b=x
 vTQzPPA3Gad+Rg8/X8DcpvwfJGEUsZcOlU2o9BvxiuZ4z6SXLLZ3N/pRpjUHc5FE
 S7+xj4nafujFQCfJK0zjsWFqTtr8JqCZZQnBFWbxEL7mC4RExtXE778UE+fLhHRM
 RLg35KpMfntyyDE4nyYB7HC5TBsaoeKqOmgbxxIxzjcOKls0TNRalp2Ne3nqsxV2
 Xrk3MVBK3ZfmLdXnya+D7X/9VD/0n5ITAzxGB7Ulq0/GKt9+pRdNkqDXCJaYNvts
 jlf93Y9rUwtu85Xd0LldG6GFWkrlE1YfBIlpW6RlDrXdGufw4t2ZFp3hB1jTawq1
 1ykex/a5drU2fDl7J2CEw==
X-ME-Sender: <xms:7BP_ZR35qOY_Buh08l2l6qIRJnEWl6ag9hoVmkF1pq5-NoZKzXV6Ow>
 <xme:7BP_ZYE7dBq5zJvsp5PvP3qp1EBY2Tahpv0ghmTeq3rIJtLbYdvAhmkWuDee-Z6Qt
 0f59HWJNNyXztu-pYA>
X-ME-Received: <xmr:7BP_ZR6UP2GuRyeF5B2CYK_IJKvciFQpwPVg7hXlsZs1sPRQkyW9QrZjwJ7PqSqO9BD5>
X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledruddtgedguddtgecutefuodetggdotefrod
 ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh
 necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd
 enucfjughrpefkffggfgfuvfevfhfhjggtgfesthekredttddvjeenucfhrhhomhepffhm
 ihhtrhihucfiuhhtohhvuceoughmihhtrhihsehguhhtohhvrdguvghvqeenucggtffrrg
 htthgvrhhnpeegleefteekgffhvdfhtdegveevveetteegteevgeettdehhfdukeetheff
 ueekkeenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpe
 gumhhithhrhiesghhuthhovhdruggvvh
X-ME-Proxy: <xmx:7BP_Ze1wsFuFtRASoIZya6JgEtbc_PnICd7-acytzjxj5zhbxwtY8g>
 <xmx:7BP_ZUHHVGxv9eN_uKy53P0J4oAGjSFJbisAn8m5Ikla1ZuF59NbWQ>
 <xmx:7BP_Zf_Y79lA6jgxxEGliMJeWKdv6927yVfzypMaKhKp_H64t02Xnw>
 <xmx:7BP_ZRkQxufTu4nskywb7Wi8ArC1FN1KQiK8-cHGb5ErW3_x60jWIw>
 <xmx:7RP_ZQgpFhTP8bwyBIZGIr8qlu580xfCgZLr7KOvRLiOl4Zw1Im4Zg>
Feedback-ID: i0e71465a:Fastmail
Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sat,
 23 Mar 2024 13:39:54 -0400 (EDT)
Message-ID: <e1d5cc5c-c15d-4c61-bead-80794040ab1f@HIDDEN>
Date: Sat, 23 Mar 2024 19:39:51 +0200
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
Subject: Re: bug#69709: `sort` interface improvement and universal ordering
 predicate
Content-Language: en-US
To: =?UTF-8?Q?Mattias_Engdeg=C3=A5rd?= <mattias.engdegard@HIDDEN>
References: <D3DD6F8C-55EA-4602-8A8C-3CDD6252CBCB@HIDDEN>
 <86zfv6uqjn.fsf@HIDDEN> <4391448A-C7AF-4D7F-8866-C0313956D52D@HIDDEN>
 <8366111E-97C4-4839-AA1E-A577C81A6035@HIDDEN>
 <bdfec2fb-8dfa-4222-8e6d-564dbd5cb982@HIDDEN>
 <4B7ACA81-DEB9-4878-BE0B-88A302AF7081@HIDDEN>
From: Dmitry Gutov <dmitry@HIDDEN>
In-Reply-To: <4B7ACA81-DEB9-4878-BE0B-88A302AF7081@HIDDEN>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 69709
Cc: 69709 <at> debbugs.gnu.org,
 =?UTF-8?Q?Gerd_M=C3=B6llmann?= <gerd.moellmann@HIDDEN>,
 Eli Zaretskii <eliz@HIDDEN>, Stefan Monnier <monnier@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

On 23/03/2024 16:58, Mattias Engdegård wrote:
> 22 mars 2024 kl. 21.55 skrev Dmitry Gutov <dmitry@HIDDEN>:
> 
>> :in-place is not too bad.
> 
> Thank you, I'm going with :in-place because :destructive puts emphasis on the wrong aspect. Sorting in-place has predictable and useful side-effects, in contrast to the old (pre-timsort) implementation that garbled the input list.

Okay.

> But non-destructive should definitely be the default. All my own experience (and from observations, that of other people) shows that it's far less error-prone. This applies to other languages as well, even very imperative ones like Python.

My concern is that it will make people write less performant code by 
default. Which will degrade unnecessarily on larger inputs (often not 
anticipated by the author in advance).

So others will have to go around each such project, ensure the original 
list is "owned" and add the :in-place argument, to reach the optimum 
performance. That's why, I think, 'sort' is mutating in most languages.

I suppose an extra copy-sequence is not that expensive, compared to most 
things. It's still extra garbage (meaning GC pauses sooner or later). 
Maybe it'll become less important with a better GC algorithm.

> The branch scratch/sort-key has been updated with polished changes, including updates of the Lisp manual.
> `value-less-p` is now called `value<`. (We could still unify it with `<`, perhaps.)
> 
> A small tweak to the implementation of non-destructive list sorting gave a speed-up of 1.1x-1.5x, which was surprisingly good. The old code just called copy-sequence on the input.
> 
> An even bigger boost was gained from special-casing the ordering predicate `value<`: 1.5x-2x speed-up on practically all input. This alone could be worth all the trouble with the patch series. We could do even better by special-casing on common key types, such as fixnums.

Very nice.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#69709; Package emacs. Full text available.

Message received at 69709 <at> debbugs.gnu.org:


Received: (at 69709) by debbugs.gnu.org; 23 Mar 2024 15:00:45 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Mar 23 11:00:45 2024
Received: from localhost ([127.0.0.1]:34226 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1ro2rU-0003sF-PJ
	for submit <at> debbugs.gnu.org; Sat, 23 Mar 2024 11:00:45 -0400
Received: from mail-lf1-f45.google.com ([209.85.167.45]:44462)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <mattias.engdegard@HIDDEN>) id 1ro2rR-0003ZP-TY
 for 69709 <at> debbugs.gnu.org; Sat, 23 Mar 2024 11:00:43 -0400
Received: by mail-lf1-f45.google.com with SMTP id
 2adb3069b0e04-512e4f4e463so3355260e87.1
 for <69709 <at> debbugs.gnu.org>; Sat, 23 Mar 2024 08:00:00 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1711205935; x=1711810735; 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=pn3d64fHXjug0/4/epV6s8CH4TLSzwP8CE+GPPOOLIE=;
 b=D29zd/vpd4PD6ytJI45ociyBP2dv2lJ7QNsP0G/DcQtvoyQmvtxW0PZI5uZ7jEvVq4
 qPx59fbxZnMmrAqlTKGoDnwxO+DRSE95NOjyOVU62mAIAGkPPnKzwgWrllKtBYWtLXcK
 wrQqMr54WGoO0PMbs/mFni/XPlWsPVYQsJnY5vVA4XmYoH3Aai6WaK7bL/NTv1mOKRt8
 DDqfmjy+bOkbjyuDCBOeWUxQ0nCgNRN8T/qIu6r8gbj5lUoF2z7h/IhqlWDNZoMaIPG+
 hR3xAln+ENgEPcUUBkkzYO5kU1ivN/kAipRUGluCnsExzG4u0liWKksYswOyj8c7OCGZ
 6qGA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1711205935; x=1711810735;
 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=pn3d64fHXjug0/4/epV6s8CH4TLSzwP8CE+GPPOOLIE=;
 b=FiMPAt4wHqaemQtfq9aZJMqAuTJl4kBMBctcGIRSGQzCbECWYlZIP7tPbhB76Y8e+b
 PyCnggrB2TKE438hhDm8SmFDT2oNbmkD3MtiK2LcIwbxPD+0LCWUqxWPrFCDa6qV+ZAY
 4KUbG5DlIJGH7f/v6yqK+wwogIaBi6zwY1UJE4Ix3CYCkhqY/L5y7EpaOa8G8I/6gDFr
 uGtfAQ5y4SnfIwTA9tNmKPJi212bZlxU0nOh8xIQzjOqlCkjmKkBNZls13JvoikCEF4C
 8Ejh7URVtjkE83QCTg4OwDCC/TAVIsc4RVhsLFIN+zpq/7bttrdgkKVMYkAEEI7ELkwW
 qxUw==
X-Forwarded-Encrypted: i=1;
 AJvYcCXuhvzmDS5/gNLD6YV9xcZSHCb3CeuijLVsLXRdwU71CQJwfGZu8u1yGxJkfcMQdBgTVfB4xhNzA3xbDHBVEOZJk0KjocE=
X-Gm-Message-State: AOJu0YwaT+kew5Fo5Na8ktfaetAg1zMHz1ClyZEGryZJlbCbLz6yjN9l
 DwCl9BMdGa8fO9aZbTbV6+KKdXmrfHCt+JGXqwtRzGJPrpTHAR7b
X-Google-Smtp-Source: AGHT+IEPVbfh2M+6VftrWYDYgWsSyxWg1B1Wyw9qDkDRJcWMWb2nEyrBj1kHZbVEIriulgI/qzq+mA==
X-Received: by 2002:a05:6512:3126:b0:513:bc63:3451 with SMTP id
 p6-20020a056512312600b00513bc633451mr1557544lfd.43.1711205934288; 
 Sat, 23 Mar 2024 07:58:54 -0700 (PDT)
Received: from smtpclient.apple (c80-217-1-132.bredband.tele2.se.
 [80.217.1.132]) by smtp.gmail.com with ESMTPSA id
 z8-20020ac25de8000000b005158c44d8cesm316280lfq.70.2024.03.23.07.58.53
 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128);
 Sat, 23 Mar 2024 07:58:53 -0700 (PDT)
Content-Type: text/plain;
	charset=us-ascii
Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.120.0.1.15\))
Subject: Re: bug#69709: `sort` interface improvement and universal ordering
 predicate
From: =?utf-8?Q?Mattias_Engdeg=C3=A5rd?= <mattias.engdegard@HIDDEN>
In-Reply-To: <bdfec2fb-8dfa-4222-8e6d-564dbd5cb982@HIDDEN>
Date: Sat, 23 Mar 2024 15:58:52 +0100
Content-Transfer-Encoding: quoted-printable
Message-Id: <4B7ACA81-DEB9-4878-BE0B-88A302AF7081@HIDDEN>
References: <D3DD6F8C-55EA-4602-8A8C-3CDD6252CBCB@HIDDEN>
 <86zfv6uqjn.fsf@HIDDEN> <4391448A-C7AF-4D7F-8866-C0313956D52D@HIDDEN>
 <8366111E-97C4-4839-AA1E-A577C81A6035@HIDDEN>
 <bdfec2fb-8dfa-4222-8e6d-564dbd5cb982@HIDDEN>
To: Dmitry Gutov <dmitry@HIDDEN>
X-Mailer: Apple Mail (2.3654.120.0.1.15)
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 69709
Cc: 69709 <at> debbugs.gnu.org,
 =?utf-8?Q?Gerd_M=C3=B6llmann?= <gerd.moellmann@HIDDEN>,
 Eli Zaretskii <eliz@HIDDEN>, Stefan Monnier <monnier@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

22 mars 2024 kl. 21.55 skrev Dmitry Gutov <dmitry@HIDDEN>:

> :in-place is not too bad.

Thank you, I'm going with :in-place because :destructive puts emphasis =
on the wrong aspect. Sorting in-place has predictable and useful =
side-effects, in contrast to the old (pre-timsort) implementation that =
garbled the input list.

But non-destructive should definitely be the default. All my own =
experience (and from observations, that of other people) shows that it's =
far less error-prone. This applies to other languages as well, even very =
imperative ones like Python.

The branch scratch/sort-key has been updated with polished changes, =
including updates of the Lisp manual.
`value-less-p` is now called `value<`. (We could still unify it with =
`<`, perhaps.)

A small tweak to the implementation of non-destructive list sorting gave =
a speed-up of 1.1x-1.5x, which was surprisingly good. The old code just =
called copy-sequence on the input.

An even bigger boost was gained from special-casing the ordering =
predicate `value<`: 1.5x-2x speed-up on practically all input. This =
alone could be worth all the trouble with the patch series. We could do =
even better by special-casing on common key types, such as fixnums.






Information forwarded to bug-gnu-emacs@HIDDEN:
bug#69709; Package emacs. Full text available.

Message received at 69709 <at> debbugs.gnu.org:


Received: (at 69709) by debbugs.gnu.org; 22 Mar 2024 20:56:49 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Mar 22 16:56:49 2024
Received: from localhost ([127.0.0.1]:48540 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1rnlwW-00066e-Lm
	for submit <at> debbugs.gnu.org; Fri, 22 Mar 2024 16:56:48 -0400
Received: from out1-smtp.messagingengine.com ([66.111.4.25]:42837)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <dmitry@HIDDEN>) id 1rnlwT-00066F-Sq
 for 69709 <at> debbugs.gnu.org; Fri, 22 Mar 2024 16:56:47 -0400
Received: from compute7.internal (compute7.nyi.internal [10.202.2.48])
 by mailout.nyi.internal (Postfix) with ESMTP id E497A5C0088;
 Fri, 22 Mar 2024 16:55:59 -0400 (EDT)
Received: from mailfrontend1 ([10.202.2.162])
 by compute7.internal (MEProxy); Fri, 22 Mar 2024 16:55:59 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gutov.dev; h=cc
 :cc:content-transfer-encoding:content-type:content-type:date
 :date:from:from:in-reply-to:in-reply-to:message-id:mime-version
 :references:reply-to:subject:subject:to:to; s=fm3; t=1711140959;
 x=1711227359; bh=oYZpkVFxjvB8QXtDRTx3aiOcYnhUFDt8rPeiBY1Twak=; b=
 YnNKmG7B0Spn1UUyDhfU/TjecaXFb8U5im8C8XK92DRWzoZTM2PPcs48b1leJp5j
 Q3Yj5h56ZdqnL9Tps2Ht7XhlHgQaXYMUxD8rY0dPMjFJ7RpSyW3Oh7qvCbLJ5PNi
 ExBobpRaEZFqT71tq485chDJ5ekAT31RLc4LDcHvmVEANC3Nvuh1qhQg+ruUh3MC
 HWp2vrZGFm2bNL8fFN8vS4PysVjyDzZg2k4JE3HDggqRIpDIMO4UyA9DSZsMX6Ki
 sHKMEbI8B4GEycH8xDm4IWNeJQYvwta8MTnUWk8UIufgXw1BMYz7amkmcGiCVCmI
 Me/Xgmfvbiukrs0W12qCNQ==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=
 messagingengine.com; h=cc:cc:content-transfer-encoding
 :content-type:content-type:date:date:feedback-id:feedback-id
 :from:from:in-reply-to:in-reply-to:message-id:mime-version
 :references:reply-to:subject:subject:to:to:x-me-proxy:x-me-proxy
 :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t=1711140959; x=
 1711227359; bh=oYZpkVFxjvB8QXtDRTx3aiOcYnhUFDt8rPeiBY1Twak=; b=f
 FJf6hmjVPukKh/iEtRUrRvdhb/tElutH0stY9WIrHf+sZgqWVd0S+eB+KnaKKhmq
 P+7970ggPotsUYJRwrHv1KJ9l7bAgaYtm7muIqG2NSzvJrbiV6CjOycwy29hETkn
 wk4YZsTYJrt+f6mWue5AuXQkmsrkoafnk0PYOY+gkZFFQlEXMExnz1Wda6Vjdnnd
 vBZrTQSJR4WX8tmh8PxILzTJ7REn6rvudNDkohQ2133bf4DBmhyKnth3GAFd1QKc
 k/Xf4P0g5WZmKKXtLxUW/9P4dPube+5nbOot6XOQsEz0L6lmwvEIrxNRUgqqGVMk
 f27rrh+0xUrHlQ0GGcdEQ==
X-ME-Sender: <xms:X_D9ZauwQtKRSg4o4-CcnsogzcA3pn9h2jPZLGRY8Uf4aJtdWLBvOQ>
 <xme:X_D9Zff2uOA8hS58h2SRB3ccKK4uxMXtrit2bz7iLCnm6UZg7aWZ3QAUUiIddFrq5
 KCJNBKuO92x6zTqDmw>
X-ME-Received: <xmr:X_D9ZVxpt7EkSwYURbUFLsirQ4_s3zzCzEtFwKYzmGuZfegMiu5A0GGK6IoqSIBNBAMh>
X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledruddtvddgjeelucetufdoteggodetrfdotf
 fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen
 uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne
 cujfgurhepkfffgggfuffvvehfhfgjtgfgsehtkeertddtvdejnecuhfhrohhmpeffmhhi
 thhrhicuifhuthhovhcuoegumhhithhrhiesghhuthhovhdruggvvheqnecuggftrfgrth
 htvghrnhepvdekteeileethfeludetueelfeegjeeghfevgfejvdevhfekiefhffejheel
 teelnecuffhomhgrihhnpegtlhhojhhurhgvughotghsrdhorhhgnecuvehluhhsthgvrh
 fuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepughmihhtrhihsehguhhtohhv
 rdguvghv
X-ME-Proxy: <xmx:X_D9ZVPwc6Gbn_id0ctYHtsB29Hbc6-zlOWD08oWWl5t9fn7T6T4MQ>
 <xmx:X_D9Za-pD6ud1nvPKzeaVzy2QBGCx54eALT_GIHuLpVwLB4Pbn3O9g>
 <xmx:X_D9ZdUVWZhgj6oZtq0EoJwUNy_Phyh5IFwJVHcolBc-cbTVEweEPA>
 <xmx:X_D9ZTc7hTDdCcPmEcVuX9I8YEEpYSJxMnhOYQKRtaA_A24l0qZVyw>
 <xmx:X_D9ZeZZ2A3x9GjyqQL5mxgZ-zEChWiHO2yBVvAZN3tI1fXK7zHuVw>
Feedback-ID: i0e71465a:Fastmail
Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri,
 22 Mar 2024 16:55:57 -0400 (EDT)
Message-ID: <bdfec2fb-8dfa-4222-8e6d-564dbd5cb982@HIDDEN>
Date: Fri, 22 Mar 2024 22:55:55 +0200
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
Subject: Re: bug#69709: `sort` interface improvement and universal ordering
 predicate
Content-Language: en-US
To: =?UTF-8?Q?Mattias_Engdeg=C3=A5rd?= <mattias.engdegard@HIDDEN>,
 Eli Zaretskii <eliz@HIDDEN>
References: <D3DD6F8C-55EA-4602-8A8C-3CDD6252CBCB@HIDDEN>
 <86zfv6uqjn.fsf@HIDDEN> <4391448A-C7AF-4D7F-8866-C0313956D52D@HIDDEN>
 <8366111E-97C4-4839-AA1E-A577C81A6035@HIDDEN>
From: Dmitry Gutov <dmitry@HIDDEN>
In-Reply-To: <8366111E-97C4-4839-AA1E-A577C81A6035@HIDDEN>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 69709
Cc: 69709 <at> debbugs.gnu.org,
 =?UTF-8?Q?Gerd_M=C3=B6llmann?= <gerd.moellmann@HIDDEN>,
 Stefan Monnier <monnier@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

On 20/03/2024 21:01, Mattias Engdegård wrote:
> * Maybe the :destructive keyword be called :inplace or :in-place instead? Shorter, less violent.

If the function default to destructive, perhaps the argument could be 
called :copy.

:in-place is not too bad. But I've looked around and don't see many 
sorting functions in other stdlibs that do it non-destructively.

Even 'sort' in Clojure might mutate: 
https://clojuredocs.org/clojure.core/sort




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#69709; Package emacs. Full text available.

Message received at 69709 <at> debbugs.gnu.org:


Received: (at 69709) by debbugs.gnu.org; 21 Mar 2024 14:57:36 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Mar 21 10:57:36 2024
Received: from localhost ([127.0.0.1]:37059 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1rnJrM-0001Qh-75
	for submit <at> debbugs.gnu.org; Thu, 21 Mar 2024 10:57:36 -0400
Received: from mail-lf1-f50.google.com ([209.85.167.50]:58791)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <mattias.engdegard@HIDDEN>) id 1rnJrH-0001QR-ER
 for 69709 <at> debbugs.gnu.org; Thu, 21 Mar 2024 10:57:34 -0400
Received: by mail-lf1-f50.google.com with SMTP id
 2adb3069b0e04-513d599dbabso1367061e87.1
 for <69709 <at> debbugs.gnu.org>; Thu, 21 Mar 2024 07:56:51 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1711032945; x=1711637745; 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=UzJ/uTbAu7xKgxp/JBqXk6UtWV0HE/Z6+ftjyAga5zg=;
 b=RPS/Sp8Q5Y7UZuOSq5+L+Im0BYdmvfYlp/6XlYQkpF/v6Oa40pNM48ayswinlkaswW
 JudVihpLtUbgvM2PlkB6hwA+dCviHGIzcBeOx/vzpZfaXOhMsb1RmmZz7dW+lPd0O+LX
 s0hStQk4INavKeehpWn/urxnIzXa8qOoLOEydwJutveqpltHHWxP3np0efLh2gb2wAr+
 gk9N/VKYz4ygE3/Pvyu8tvEdrC0c2WAtTWBATNON9alDPVk2fPJDzm0e0khTluu3dPxP
 rgbB96YwdKzrsTojTBOSlUwCkD7/qEb14+DmxqYYXBrgdhqMKyeA2XrviPE7fHqzxA13
 zOOA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1711032945; x=1711637745;
 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=UzJ/uTbAu7xKgxp/JBqXk6UtWV0HE/Z6+ftjyAga5zg=;
 b=obp/ERNufsNxrc7B5zQNFf9bF47vIYt4ztzkRfMhEnIyhhAVcYTuMRUvPlEpfJeuuy
 SuNSC/L27LgERGTXApmJ5jKYu38jDi+Y9xBwsAoaTBslKhyHvDfRKbHCsbm1UeZkmWYH
 4XYhvk23jDt2YW8nq9Au4FR9LrLoz+nX0gSEoxiu0Wuk/gfOr/+m4W4q83IjqYfzk/hV
 c7xPORz+usYvZNUuVd5S/LAdvRyOfzHXSTaUAdH7KQUNUHOdR5lG5OnU/vA+9h7P+amv
 W7SH4qMK75tIKQH4j/cqPvhk20JeW7lS0G5o7U2FUE0c5Wss6w1S1QHrW4QgZWfFLcLD
 +8Ag==
X-Forwarded-Encrypted: i=1;
 AJvYcCUenXCVjjHFtPTH/XeojS11XGr7FGlvtcfrmWtNWmqL6eIGZLEhvL2ze3u0S/sae8QGdM3YSCdZ2VwweAHe0ClDUvW9R5M=
X-Gm-Message-State: AOJu0YyIp62tKJNf7BwGHQa4lMQCna7UZw48gzcP+5ZMWv+mpSa/rqM5
 MpqQGeLYj9wJQntKDO6Fc0B5FMgGljd2vP8t+9dntsLKrZpOxqbO
X-Google-Smtp-Source: AGHT+IGq/l8GXmM9EFUOQSKZhLw1hIw/bC/3Aocy8MZYwgJIsx6W+xpIm3V/XTw9UEgOYSWeJyVOBQ==
X-Received: by 2002:a19:6408:0:b0:513:d32a:89e1 with SMTP id
 y8-20020a196408000000b00513d32a89e1mr7104495lfb.51.1711032945247; 
 Thu, 21 Mar 2024 07:55:45 -0700 (PDT)
Received: from smtpclient.apple (c80-217-1-132.bredband.tele2.se.
 [80.217.1.132]) by smtp.gmail.com with ESMTPSA id
 n12-20020a056512388c00b005131cf043f8sm2589973lft.155.2024.03.21.07.55.44
 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128);
 Thu, 21 Mar 2024 07:55:44 -0700 (PDT)
Content-Type: text/plain;
	charset=us-ascii
Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.120.0.1.15\))
Subject: Re: bug#69709: `sort` interface improvement and universal ordering
 predicate
From: =?utf-8?Q?Mattias_Engdeg=C3=A5rd?= <mattias.engdegard@HIDDEN>
In-Reply-To: <jwv4jd0itll.fsf-monnier+emacs@HIDDEN>
Date: Thu, 21 Mar 2024 15:55:43 +0100
Content-Transfer-Encoding: quoted-printable
Message-Id: <2B967217-98CA-40CE-883B-C65377C683A3@HIDDEN>
References: <D3DD6F8C-55EA-4602-8A8C-3CDD6252CBCB@HIDDEN>
 <86zfv6uqjn.fsf@HIDDEN> <4391448A-C7AF-4D7F-8866-C0313956D52D@HIDDEN>
 <8366111E-97C4-4839-AA1E-A577C81A6035@HIDDEN>
 <jwv4jd0itll.fsf-monnier+emacs@HIDDEN>
To: Stefan Monnier <monnier@HIDDEN>
X-Mailer: Apple Mail (2.3654.120.0.1.15)
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 69709
Cc: 69709 <at> debbugs.gnu.org,
 =?utf-8?Q?Gerd_M=C3=B6llmann?= <gerd.moellmann@HIDDEN>,
 Eli Zaretskii <eliz@HIDDEN>, Dmitry Gutov <dmitry@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

20 mars 2024 kl. 20.37 skrev Stefan Monnier <monnier@HIDDEN>:

> IOW, I vote for `<`!

That may actually be within the realms of possibility. Some snags:

* Not sure if code using `<` and expect a type error for non-numbers =
would be confused (probably not)
* Making `value<` n-ary would slow it down a bit, unclear how much
* `value<` compares markers by buffer then position, `<` by position =
only
* `<` can compare markers with numbers
* We expect consistency and shared code for all of < > <=3D >=3D =3D /=3D =
but it's unclear how `value<` would be generalised in that direction (at =
least if we care about NaN correctness)

Currently, `value<` treats NaN as if it were equal to any number, which =
is terrible and useless but consistent with `<`. Other options would =
include order NaN distinct from any number, perhaps just consider all =
NaNs to be equal and put them before or after all numbers.

`value<` is actually quite a bit faster than `<` which has a terribly =
cumbersome implementation, except for pairs of fixnums which apparently =
got special-cased in `<` and the other inequalities fairly recently.

By the way, I ran some more benchmarks: it turns out that =
`car-less-than-car`, the secret shortcut that you just had to know, now =
gives roughly the same speed as :key #'car which is a lot more =
discoverable (and works for many other types).







Information forwarded to bug-gnu-emacs@HIDDEN:
bug#69709; Package emacs. Full text available.

Message received at 69709 <at> debbugs.gnu.org:


Received: (at 69709) by debbugs.gnu.org; 21 Mar 2024 14:55:17 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Mar 21 10:55:17 2024
Received: from localhost ([127.0.0.1]:37051 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1rnJp7-0001Mz-3C
	for submit <at> debbugs.gnu.org; Thu, 21 Mar 2024 10:55:17 -0400
Received: from mail.eshelyaron.com ([107.175.124.16]:58744 helo=eshelyaron.com)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <me@HIDDEN>) id 1rnJp4-0001Mq-RW
 for 69709 <at> debbugs.gnu.org; Thu, 21 Mar 2024 10:55:15 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=eshelyaron.com;
 s=mail; t=1711032874;
 bh=qJm05GgggxNJbCGJG00vtYteF2VZvT8d6cjfbWcZ3NA=;
 h=From:To:Cc:Subject:In-Reply-To:References:Date:From;
 b=AiQa5c6pNYEpAhdiQzebcFgOJ6ScKnqpBGWNo4WMn9iDrQ58nF4+FoCc+Ohj7hwhJ
 86nXJaAfQu4hY1Ka6/WtQV7Lkibi4iwNUovpCg+yBKMXvo69qtiyjuYMHUKSW7aEmh
 C8Y9ZQacZ0bEyfZQsCQxQ6IWG2Hi8eEdKuRSqed0RVbAWUwDXDAyvfbdh/GOT7wu0X
 szUk95o5Fxhl1qWCuz65+Noa6Kjom37o1IJnDCN3JxhjzQQFXRUiMKGAV2BHRG2zLu
 HrKYsUwj0luTGAE5Qlgl0W8XJQ2FEzXRw+dqaZGv9e5sXjLQcA9i++XPDi26uBooUq
 KaMJmJL7gmyyw==
From: Eshel Yaron <me@HIDDEN>
To: Mattias =?utf-8?Q?Engdeg=C3=A5rd?= <mattias.engdegard@HIDDEN>
Subject: Re: bug#69709: `sort` interface improvement and universal ordering
 predicate
In-Reply-To: <8366111E-97C4-4839-AA1E-A577C81A6035@HIDDEN> ("Mattias
 =?utf-8?Q?Engdeg=C3=A5rd=22's?= message of "Wed, 20 Mar 2024
 20:01:39 +0100")
References: <D3DD6F8C-55EA-4602-8A8C-3CDD6252CBCB@HIDDEN>
 <86zfv6uqjn.fsf@HIDDEN>
 <4391448A-C7AF-4D7F-8866-C0313956D52D@HIDDEN>
 <8366111E-97C4-4839-AA1E-A577C81A6035@HIDDEN>
X-Hashcash: 1:20:240321:monnier@HIDDEN::++wP6CsOQLfYqX+r:1NGs
X-Hashcash: 1:20:240321:gerd.moellmann@HIDDEN::ugmCKSkCZ3nyRu5l:0eIE
X-Hashcash: 1:20:240321:dmitry@HIDDEN::t4vc/GlQHV+y6Xb9:0xG1
X-Hashcash: 1:20:240321:69709 <at> debbugs.gnu.org::GsU61g1Xll+u6qEj:9sYR
Date: Thu, 21 Mar 2024 15:54:31 +0100
Message-ID: <m17chvhbyw.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 69709
Cc: 69709 <at> debbugs.gnu.org,
 Gerd =?utf-8?Q?M=C3=B6llmann?= <gerd.moellmann@HIDDEN>,
 Eli Zaretskii <eliz@HIDDEN>, Stefan Monnier <monnier@HIDDEN>,
 Dmitry Gutov <dmitry@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Hi,

Mattias Engdeg=C3=A5rd <mattias.engdegard@HIDDEN> writes:

> Now the origin/scratch/sort-key branch contains a draft proposal. Summary:
>
> * Our timsort has now the key function handling from the original code (p=
orted to Emacs).
> * New keyword-based calling convention for `sort`. The old one is still t=
here 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 s=
hould be removed.

In case it hasn't already been mentioned, AFAICT this also applies to
`minibuffer--sort-by-key` (which is very similar to `sort-on`).

> * Performance seems fine from initial tests. More comprehensive benchmark=
ing 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.

Perhaps the "standard order" of Prolog terms programs could be an
interesting reference:
https://www.swi-prolog.org/pldoc/man?section=3Dstandardorder


Best,

Eshel




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#69709; Package emacs. Full text available.

Message received at 69709 <at> debbugs.gnu.org:


Received: (at 69709) by debbugs.gnu.org; 20 Mar 2024 19:41:10 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Mar 20 15:41:10 2024
Received: from localhost ([127.0.0.1]:59173 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1rn1o8-0007KW-Qn
	for submit <at> debbugs.gnu.org; Wed, 20 Mar 2024 15:41:10 -0400
Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:4499)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <monnier@HIDDEN>) id 1rn1o2-0007Jh-L1
 for 69709 <at> debbugs.gnu.org; Wed, 20 Mar 2024 15:41:03 -0400
Received: from pmg1.iro.umontreal.ca (localhost.localdomain [127.0.0.1])
 by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 3FA8110004C;
 Wed, 20 Mar 2024 15:40:13 -0400 (EDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca;
 s=mail; t=1710963612;
 bh=2SdKnQrYlDvq2TN/mEtfhBx18fYuA1in5VP6p5reRxA=;
 h=From:To:Cc:Subject:In-Reply-To:References:Date:From;
 b=Z+deX5qbd3JdwfuC+DlG+3OINXp03ljEOBS4BjOVtsJ6sGf0xwM/W6DDy1eNk0vnx
 PRAX4x+ppJBW8p7k1qRanhngLPGn0IMTEBK2z91jOZwbOOZHhcD/4Msp+bd8ozkXVS
 S4B+T21tHg7ETx6lWYnUDFvTyBR0Wm/TzWiW1jwqpAv1LXpAr6lHqJOiCoB0gfHb7D
 opwQ5J0kfxkhkviALhU81W7E+IAn+apH154c3mhV/JKP0CCzY0hob2WQv/GoRVSA/k
 WI5N7DEl+s7rEtJSNkElxAggONrc2xS9Dfg5SLBZjooCYlQ7RdX+LAu8Vfn2pk5DgR
 9yQouxjS5tXTg==
Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1])
 by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 5A1E5100046;
 Wed, 20 Mar 2024 15:40:12 -0400 (EDT)
Received: from lechazo (lechon.iro.umontreal.ca [132.204.27.242])
 by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 44BB31207AC;
 Wed, 20 Mar 2024 15:40:12 -0400 (EDT)
From: Stefan Monnier <monnier@HIDDEN>
To: Mattias =?windows-1252?Q?Engdeg=E5rd?= <mattias.engdegard@HIDDEN>
Subject: Re: bug#69709: `sort` interface improvement and universal ordering
 predicate
In-Reply-To: <8366111E-97C4-4839-AA1E-A577C81A6035@HIDDEN> ("Mattias
 =?windows-1252?Q?Engdeg=E5rd=22's?= message of "Wed, 20 Mar 2024 20:01:39
 +0100")
Message-ID: <jwv4jd0itll.fsf-monnier+emacs@HIDDEN>
References: <D3DD6F8C-55EA-4602-8A8C-3CDD6252CBCB@HIDDEN>
 <86zfv6uqjn.fsf@HIDDEN>
 <4391448A-C7AF-4D7F-8866-C0313956D52D@HIDDEN>
 <8366111E-97C4-4839-AA1E-A577C81A6035@HIDDEN>
Date: Wed, 20 Mar 2024 15:37:59 -0400
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain
X-SPAM-INFO: Spam detection results:  0
 ALL_TRUSTED                -1 Passed through trusted hosts only via SMTP
 AWL 0.105 Adjusted score from AWL reputation of From: address
 BAYES_00                 -1.9 Bayes spam probability is 0 to 1%
 DKIM_SIGNED               0.1 Message has a DKIM or DK signature,
 not necessarily valid
 DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature
 DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's
 domain
 DKIM_VALID_EF -0.1 Message has a valid DKIM or DK signature from envelope-from
 domain T_SCC_BODY_TEXT_LINE    -0.01 -
X-SPAM-LEVEL: 
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 69709
Cc: 69709 <at> debbugs.gnu.org,
 Gerd =?windows-1252?Q?M=F6llmann?= <gerd.moellmann@HIDDEN>,
 Eli Zaretskii <eliz@HIDDEN>, Dmitry Gutov <dmitry@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> * Better name for `value-less-p`:
>     value<
>     {generic,universal,standard,lisp}{-less-p,<}
                                     ^^
                                     ,
:-)

IOW, I vote for `<`!


        Stefan





Information forwarded to bug-gnu-emacs@HIDDEN:
bug#69709; Package emacs. Full text available.

Message received at 69709 <at> debbugs.gnu.org:


Received: (at 69709) by debbugs.gnu.org; 20 Mar 2024 19:10:21 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Mar 20 15:10:21 2024
Received: from localhost ([127.0.0.1]:57527 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1rn1KP-0005yL-0A
	for submit <at> debbugs.gnu.org; Wed, 20 Mar 2024 15:10:21 -0400
Received: from mail-lf1-f49.google.com ([209.85.167.49]:51496)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <mattias.engdegard@HIDDEN>) id 1rn1Di-0005en-Nj
 for 69709 <at> debbugs.gnu.org; Wed, 20 Mar 2024 15:03:27 -0400
Received: by mail-lf1-f49.google.com with SMTP id
 2adb3069b0e04-513dd2d2415so219920e87.3
 for <69709 <at> 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)
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)
Content-Type: text/plain;
	charset=us-ascii
Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.120.0.1.15\))
Subject: Re: bug#69709: `sort` interface improvement and universal ordering
 predicate
From: =?utf-8?Q?Mattias_Engdeg=C3=A5rd?= <mattias.engdegard@HIDDEN>
In-Reply-To: <4391448A-C7AF-4D7F-8866-C0313956D52D@HIDDEN>
Date: Wed, 20 Mar 2024 20:01:39 +0100
Content-Transfer-Encoding: quoted-printable
Message-Id: <8366111E-97C4-4839-AA1E-A577C81A6035@HIDDEN>
References: <D3DD6F8C-55EA-4602-8A8C-3CDD6252CBCB@HIDDEN>
 <86zfv6uqjn.fsf@HIDDEN> <4391448A-C7AF-4D7F-8866-C0313956D52D@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
X-Mailer: Apple Mail (2.3654.120.0.1.15)
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 69709
Cc: 69709 <at> debbugs.gnu.org,
 =?utf-8?Q?Gerd_M=C3=B6llmann?= <gerd.moellmann@HIDDEN>,
 Stefan Monnier <monnier@HIDDEN>, Dmitry Gutov <dmitry@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

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






Information forwarded to bug-gnu-emacs@HIDDEN:
bug#69709; Package emacs. Full text available.

Message received at 69709 <at> debbugs.gnu.org:


Received: (at 69709) by debbugs.gnu.org; 11 Mar 2024 07:02:47 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Mar 11 03:02:47 2024
Received: from localhost ([127.0.0.1]:38558 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1rjZgN-00048i-Jg
	for submit <at> debbugs.gnu.org; Mon, 11 Mar 2024 03:02:47 -0400
Received: from mail-ed1-f41.google.com ([209.85.208.41]:44294)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <gerd.moellmann@HIDDEN>) id 1rjZgL-00048U-H1
 for 69709 <at> debbugs.gnu.org; Mon, 11 Mar 2024 03:02:46 -0400
Received: by mail-ed1-f41.google.com with SMTP id
 4fb4d7f45d1cf-5654f700705so4902748a12.1
 for <69709 <at> debbugs.gnu.org>; Mon, 11 Mar 2024 00:02:11 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1710140465; x=1710745265; darn=debbugs.gnu.org;
 h=content-transfer-encoding:mime-version:user-agent:message-id:date
 :references:in-reply-to:subject:cc:to:from:from:to:cc:subject:date
 :message-id:reply-to;
 bh=admWAVnvWJdPuPTd2ppwrSDYfZxiVQz0MMnKkb1OSPs=;
 b=KOsCllqyixwWkwdKyg8Ze/SwI2r5+WfnqXtaboOgfJFPHkGGeU+uhruRU+A1caKIXQ
 Vj95tdq5rU+2AlA0klKJ+p50Rt1UCbp3sZiwzOKNsbm8D7x3lNV87lT3UXxoDIVB3xqN
 WjWbMccL1JeI7biVUvcSYJEnsjT8AncghC02pWYqGWa2pbM+CGGjTRj9Xt6SvM1zspvd
 hPLUGqWKd3J7qP3PENaEEpYytS7ENKl8WqoS6WRcyiOq78+ddyjnyuTghBFmAsMCCmQ7
 yYxZZvSaNUGcTLcUGbsNP4fE5C5NsIoLIilQjniXUFYGf+zVVfiRMzHDRGhYor0Zv/6O
 Q2Fw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1710140465; x=1710745265;
 h=content-transfer-encoding:mime-version:user-agent:message-id:date
 :references:in-reply-to:subject:cc:to:from:x-gm-message-state:from
 :to:cc:subject:date:message-id:reply-to;
 bh=admWAVnvWJdPuPTd2ppwrSDYfZxiVQz0MMnKkb1OSPs=;
 b=tSDiqnNhtaJ71GiG4NjASozpEaaJNanwvtEw+fpbt+J+G5Hl4hKmKv0NIxBj+hVftj
 fdFW2Wii+pblkUd2Mlg5YImj/YHaPgGx3TfS3ZyRqlV4HNe261v7ucBFEIJTb5rav/ZE
 eE1Va7bDq7Cv/41AuP89yRI7tBkZ/0u6+uL7alc/kHy5F1BjvNsHQxPiUci/l+MUOxbX
 /XkLF/Pg8u1UVCMqNysRc1QfXyB9zbdbdPvlryEsoAVD9S4eHsT6NszjxRGFpSyRd9LW
 NhEMgl0M6Hka+trU3gTzFfwDtOWsb/LXPvKvMsquXS7ijNlCoRUidFeKSly7mOC93xgg
 anTA==
X-Gm-Message-State: AOJu0Yw5p4W4N/T1POfC/BmzVs0guS3x7pH7BlSN86WTRAe0uVeX56Ii
 pZiVuI4TeMAmZdZHUC9AeKBR92ZY4xfa3PDzVNxZaa3C/dp8zDjtdRVJQhyn
X-Google-Smtp-Source: AGHT+IHyMHhNx20PioOgR1mQKBelep7LLcaXQftVixJHax5utGQkh1GpVPgMoXivOeaeM/NlAK0x+g==
X-Received: by 2002:a17:906:e08c:b0:a45:f6ad:1c78 with SMTP id
 gh12-20020a170906e08c00b00a45f6ad1c78mr3759279ejb.49.1710140465098; 
 Mon, 11 Mar 2024 00:01:05 -0700 (PDT)
Received: from Pro.fritz.box (p4fe3a0ad.dip0.t-ipconnect.de. [79.227.160.173])
 by smtp.gmail.com with ESMTPSA id
 jg15-20020a170907970f00b00a45c8b6e965sm2568361ejc.3.2024.03.11.00.01.04
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Mon, 11 Mar 2024 00:01:04 -0700 (PDT)
From: =?utf-8?Q?Gerd_M=C3=B6llmann?= <gerd.moellmann@HIDDEN>
To: Mattias =?utf-8?Q?Engdeg=C3=A5rd?= <mattias.engdegard@HIDDEN>
Subject: Re: bug#69709: `sort` interface improvement and universal ordering
 predicate
In-Reply-To: <D3DD6F8C-55EA-4602-8A8C-3CDD6252CBCB@HIDDEN> ("Mattias
 =?utf-8?Q?Engdeg=C3=A5rd=22's?= message of "Sun, 10 Mar 2024 14:28:02
 +0100")
References: <D3DD6F8C-55EA-4602-8A8C-3CDD6252CBCB@HIDDEN>
Date: Mon, 11 Mar 2024 08:01:03 +0100
Message-ID: <m2o7bl8d74.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 69709
Cc: 69709 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Mattias Engdeg=C3=A5rd <mattias.engdegard@HIDDEN> writes:

> 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

FWIW, I wouldn't like overloading the name 'sort', because it feels like
magic happening. A new name would make things explicit - no magic.

Otherwise, I can't say much. The destructiveness of sort/stable-sort has
actually never been a problem for me. It has instead often been just
right, when consing a sequence and sorting it in the end.





Information forwarded to bug-gnu-emacs@HIDDEN:
bug#69709; Package emacs. Full text available.

Message received at 69709 <at> debbugs.gnu.org:


Received: (at 69709) by debbugs.gnu.org; 10 Mar 2024 17:54:58 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Mar 10 13:54:58 2024
Received: from localhost ([127.0.0.1]:37854 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1rjNNy-0000ID-Ea
	for submit <at> debbugs.gnu.org; Sun, 10 Mar 2024 13:54:58 -0400
Received: from out2-smtp.messagingengine.com ([66.111.4.26]:45771)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <dmitry@HIDDEN>) id 1rjNNw-0000I0-LR
 for 69709 <at> debbugs.gnu.org; Sun, 10 Mar 2024 13:54:57 -0400
Received: from compute1.internal (compute1.nyi.internal [10.202.2.41])
 by mailout.nyi.internal (Postfix) with ESMTP id 2484A5C003F;
 Sun, 10 Mar 2024 13:54:18 -0400 (EDT)
Received: from mailfrontend1 ([10.202.2.162])
 by compute1.internal (MEProxy); Sun, 10 Mar 2024 13:54:18 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gutov.dev; h=cc
 :cc:content-transfer-encoding:content-type:content-type:date
 :date:from:from:in-reply-to:in-reply-to:message-id:mime-version
 :references:reply-to:subject:subject:to:to; s=fm3; t=1710093258;
 x=1710179658; bh=7KRiLafAgo5iY5MPTZhMAk2NGufxOuZku/2cJrmuGdA=; b=
 okiltGTtFNub5D2eJJEE8d28m/vxh0Pjxa8ziF4Jz18C047Wu9MDNKgz6QVKVd96
 +MPvs8CmxvhMoOPqkD765zGURKgeMyddanBY/ZfFq5lVLoZb1XwL26HwhS7YCtx5
 Sty+Jyiad7DiS34qWzhM5Jsnl/amfwhjKnZ6RrJuvre7AyKYUWGR5Fbm+cCGlEBM
 x4ZHqx0Nn5rZzF02ZCP226wgnoVwWFlvouq+LE3m903mkW8W/DdpuxmOpHexJmdN
 LoKiyXsR2J3cJP7k3td7I2D1gFHr/DsXQOz5yo6QmpmA+kmxCs8CuDWjwST3JL55
 ohHRzjNXTC+U9r17MzueoQ==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=
 messagingengine.com; h=cc:cc:content-transfer-encoding
 :content-type:content-type:date:date:feedback-id:feedback-id
 :from:from:in-reply-to:in-reply-to:message-id:mime-version
 :references:reply-to:subject:subject:to:to:x-me-proxy:x-me-proxy
 :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t=1710093258; x=
 1710179658; bh=7KRiLafAgo5iY5MPTZhMAk2NGufxOuZku/2cJrmuGdA=; b=a
 TiljYyOGMdbCGRmsdqD9fl0FRGSYP7uLEqYAuGHdkpLdXF0oduZ9Elqz/GtCU7IM
 NZPAUjp084E1lpssF3zV9z/HXbS2caIXsRHlxeFhJBWKrVcurntsjAR4Wfive56T
 IKxp2V4a9EO2KeQRrDSdBtED6GrvEzh/jKkM9yfRT18z3yiL35LaBk5NvBipQ96W
 uhVFS46Yg8GKnjtZ9dqW6LRVKFpKvMUiv1eBzv6kBXxwfZi+osvaytB0uRCfeCF3
 Z+YoTtmdluot2oUaBKjz3f2Yg08NEGkXRxLVV3HyNCRPjReTq1zBSwU7GupUf2B+
 3G2gnNMfKrmBPWyG1MW5g==
X-ME-Sender: <xms:yfPtZZTiFO1PMbA3G6uOQiQuIzc-MA4t_P56GtnXmWvebXzLPGvi0Q>
 <xme:yfPtZSyN2zW_8Q_pFhL6XlegdVuETrlxSx02HPSpxlF0NEfP6VKJ-shZ94pQj2oPy
 MNpq5H7FCzn9GGaFCw>
X-ME-Received: <xmr:yfPtZe37QHOO98cue7FpzD1VPwJGt3G95IbscTzVua2gZu1FEZBB__ylCrDauriKMpET>
X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrieelgddutdeiucetufdoteggodetrfdotf
 fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen
 uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne
 cujfgurhepkfffgggfuffvvehfhfgjtgfgsehtkeertddtvdejnecuhfhrohhmpeffmhhi
 thhrhicuifhuthhovhcuoegumhhithhrhiesghhuthhovhdruggvvheqnecuggftrfgrth
 htvghrnhepgeelfeetkefghfdvhfdtgeevveevteetgeetveegtedthefhudekteehffeu
 keeknecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepug
 hmihhtrhihsehguhhtohhvrdguvghv
X-ME-Proxy: <xmx:yvPtZRCeYX48eIRvv8PPHFXDufXLn6BWdiBrzukMhdhjfxFyoWnmRw>
 <xmx:yvPtZShxllZeTtpV9f4UAchUpnQcje_6XSzjMKqoGR_vOGaR_RoHmg>
 <xmx:yvPtZVq6fokHyi8wq0-bHNiAFe8_6oh2cYLPVelGTzA5E0HclxdGJg>
 <xmx:yvPtZWZbaM9rpFwqmG686S5NEx2spWJU2bEryNZ-G0aG1Iiu_UqgoA>
Feedback-ID: i0e71465a:Fastmail
Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sun,
 10 Mar 2024 13:54:16 -0400 (EDT)
Message-ID: <cc3ec2b8-424a-4465-895f-c39c527ffa05@HIDDEN>
Date: Sun, 10 Mar 2024 19:54:16 +0200
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
Subject: Re: bug#69709: `sort` interface improvement and universal ordering
 predicate
Content-Language: en-US
To: Eli Zaretskii <eliz@HIDDEN>,
 =?UTF-8?Q?Mattias_Engdeg=C3=A5rd?= <mattias.engdegard@HIDDEN>
References: <D3DD6F8C-55EA-4602-8A8C-3CDD6252CBCB@HIDDEN>
 <def3403e-eae5-4363-8d83-ef7fea155bbe@HIDDEN>
 <0A9CE0FD-AE2D-462C-906D-567F331CC98B@HIDDEN>
 <0e13de8a-ab0c-404d-9d93-d3756abcfa43@HIDDEN>
 <E3500800-AADA-433F-BEB5-4A72F954A561@HIDDEN> <86wmqauiv2.fsf@HIDDEN>
From: Dmitry Gutov <dmitry@HIDDEN>
In-Reply-To: <86wmqauiv2.fsf@HIDDEN>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 69709
Cc: 69709 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

On 10/03/2024 18:55, Eli Zaretskii wrote:
>> Cc:69709 <at> debbugs.gnu.org
>> From: Mattias Engdegård<mattias.engdegard@HIDDEN>
>> Date: Sun, 10 Mar 2024 17:46:59 +0100
>>
>> 10 mars 2024 kl. 17.03 skrev Dmitry Gutov<dmitry@HIDDEN>:
>>
>>> That sounds more confusing, though (you drop the 'pred' argument, and the function changes behavior, possibly becoming slower too).
>> Is it really surprising that behaviour changes if you remove a previously-mandatory argument from a call without reading the documentation? It seems unlikely that this would happen by accident.
> I think we should delay this discussion until we see the first draft
> of the code and the documentation to go with it.  As long as the issue
> is in Mattias's sights, I'm sure the result will be acceptable, to say
> the least.

I do think it's problematic, but it's not a deal-breaker, so if everyone 
else is fine with it, let's proceed.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#69709; Package emacs. Full text available.

Message received at 69709 <at> debbugs.gnu.org:


Received: (at 69709) by debbugs.gnu.org; 10 Mar 2024 16:56:25 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Mar 10 12:56:25 2024
Received: from localhost ([127.0.0.1]:37782 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1rjMTJ-00075E-AZ
	for submit <at> debbugs.gnu.org; Sun, 10 Mar 2024 12:56:25 -0400
Received: from eggs.gnu.org ([209.51.188.92]:37246)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1rjMTH-00074y-Lv
 for 69709 <at> debbugs.gnu.org; Sun, 10 Mar 2024 12:56:24 -0400
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 <eliz@HIDDEN>)
 id 1rjMSd-0005Po-CL; Sun, 10 Mar 2024 12:55:45 -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=5hw+/p1QL5tR468NHdXPYSxmmloApomqxVdZSDlUdQo=; b=PFbrUeL/9k7v/bxKFIzz
 6GXKwvSCV/sOsp5RkqENzkpzF6ySl4+vsMoWRtyAIrPywG2B+B7MfNFqEx34Ludm6uWLuMNUZ+sU5
 br/6vsLA5snMQPeEOlSmDjWt7ORc7MoVvYuNtslk8Yy4hAWnHD0L/EOUQGKyVWvvOEYKwJnIu9dwT
 CnAaQw0YT+jXsgq/fMd428yH/hpFr3zVuLxtpQ4IDVE2f4Um+wBON4zI1YM1Zml3rsdgylfAKu1aC
 ye9qypPOG22oLtLb3p0RsVRzJ/O3IQ2d2U2f6c1vefRGwtDYci0hSPOPacEfJA6qULKeZnIhIyN4U
 3JVU0BMrY0kfIw==;
Date: Sun, 10 Mar 2024 18:55:29 +0200
Message-Id: <86wmqauiv2.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Mattias =?utf-8?Q?Engdeg=C3=A5rd?= <mattias.engdegard@HIDDEN>
In-Reply-To: <E3500800-AADA-433F-BEB5-4A72F954A561@HIDDEN> (message from
 Mattias =?utf-8?Q?Engdeg=C3=A5rd?= on Sun, 10 Mar 2024 17:46:59 +0100)
Subject: Re: bug#69709: `sort` interface improvement and universal ordering
 predicate
References: <D3DD6F8C-55EA-4602-8A8C-3CDD6252CBCB@HIDDEN>
 <def3403e-eae5-4363-8d83-ef7fea155bbe@HIDDEN>
 <0A9CE0FD-AE2D-462C-906D-567F331CC98B@HIDDEN>
 <0e13de8a-ab0c-404d-9d93-d3756abcfa43@HIDDEN>
 <E3500800-AADA-433F-BEB5-4A72F954A561@HIDDEN>
MIME-version: 1.0
Content-type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 69709
Cc: 69709 <at> debbugs.gnu.org, dmitry@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> Cc: 69709 <at> debbugs.gnu.org
> From: Mattias Engdegård <mattias.engdegard@HIDDEN>
> Date: Sun, 10 Mar 2024 17:46:59 +0100
> 
> 10 mars 2024 kl. 17.03 skrev Dmitry Gutov <dmitry@HIDDEN>:
> 
> > That sounds more confusing, though (you drop the 'pred' argument, and the function changes behavior, possibly becoming slower too).
> 
> Is it really surprising that behaviour changes if you remove a previously-mandatory argument from a call without reading the documentation? It seems unlikely that this would happen by accident.

I think we should delay this discussion until we see the first draft
of the code and the documentation to go with it.  As long as the issue
is in Mattias's sights, I'm sure the result will be acceptable, to say
the least.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#69709; Package emacs. Full text available.

Message received at 69709 <at> debbugs.gnu.org:


Received: (at 69709) by debbugs.gnu.org; 10 Mar 2024 16:48:43 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Mar 10 12:48:43 2024
Received: from localhost ([127.0.0.1]:37777 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1rjMLr-0006lE-8R
	for submit <at> debbugs.gnu.org; Sun, 10 Mar 2024 12:48:43 -0400
Received: from mail-lj1-f169.google.com ([209.85.208.169]:48474)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <mattias.engdegard@HIDDEN>) id 1rjMLo-0006kO-KY
 for 69709 <at> debbugs.gnu.org; Sun, 10 Mar 2024 12:48:41 -0400
Received: by mail-lj1-f169.google.com with SMTP id
 38308e7fff4ca-2d3f962a9dfso23825331fa.1
 for <69709 <at> debbugs.gnu.org>; Sun, 10 Mar 2024 09:48:07 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1710089221; x=1710694021; 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=zgAGXY88B21ElS1ZxMNK4QKfyUpzVsqv0JKZtJ6uoUs=;
 b=iXcQQKVmXffMB629S21RsZ4jmiLgg9Z5ewyg/l3eeFqr++9jFvsWy6gIEZIhAtH3Z2
 6l60MNPAOVAF5juDj5RHbv+9XLcKCPZyXtZYwjtH8HO1OS33vnBBDYdNAoYaEZY893+M
 qauyDijXfUj3HL7cbKKNd3XQ4oY4BxoG8uz1XS+b9G4IasLLWOyb5AF9NAoGPvUCJ3kh
 I6C7g0Ax90xW0hjEwlwYKsGL/XrN9RvvCA6q+r3y4s4hHRq3GIKhIxEMGFbIpgNg7SB2
 y20vYmS06oWZ+ZuuTu/1s7ROVQ4pQRlsIH3IMwYJAcvmgl6xhCi9Utj+7NLqArcksosD
 FsGg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1710089221; x=1710694021;
 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=zgAGXY88B21ElS1ZxMNK4QKfyUpzVsqv0JKZtJ6uoUs=;
 b=ChS+otXWVqvZaiN/eRnR+yn0gJ/gp+ao/w582zchMSbA7MOh7S4brTnfPhQMhLUPPz
 QhmHXRMCvTn/tpL+e2mruZgTOa3RV2c5iN2BGCPD6Rl6b1wEOVE/Ya/PIRoJigkpWOL0
 AfqT1JBzwrps3NkT5CxIOjI4NQAd8LaLPSYE6ztkc5bs62guF1+laEebpgPB/YGcipPi
 ud2UNMpBTpDKSkSMxyO2tfFRYO8/Jm2H7ZrNTwntsvHVl+ShdIIU1S1i7cXFDU7Q7duV
 osN14qf1dt/VAHJqVOJx2Y7CdTnZTXetpMsJTB1Bb+YccFgX7erNwlSLZMZ3uSU1R9WW
 oSIw==
X-Gm-Message-State: AOJu0Yw/oqE4ojJ31Y4WhUiNQayW6prZa123gBhnUmZg4m5Np8oFzraN
 f9cZNDG5EOsQMi+y7pZr+hWff3nwT17fEZX9bvEgzCMGpO3B5sd0
X-Google-Smtp-Source: AGHT+IElhJk9em5f5DWgTaAnSrQEOlcjXEMGD6c3QJwZqM4rnDwR8nh8oCyRCe0hzOrc3ddQoXJEjA==
X-Received: by 2002:a2e:bc29:0:b0:2d3:d9fd:568d with SMTP id
 b41-20020a2ebc29000000b002d3d9fd568dmr3436667ljf.8.1710089221062; 
 Sun, 10 Mar 2024 09:47:01 -0700 (PDT)
Received: from smtpclient.apple (c80-217-1-132.bredband.tele2.se.
 [80.217.1.132]) by smtp.gmail.com with ESMTPSA id
 v3-20020a2e9603000000b002d21f1f1e82sm738317ljh.3.2024.03.10.09.46.59
 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128);
 Sun, 10 Mar 2024 09:47:00 -0700 (PDT)
Content-Type: text/plain;
	charset=us-ascii
Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.120.0.1.15\))
Subject: Re: bug#69709: `sort` interface improvement and universal ordering
 predicate
From: =?utf-8?Q?Mattias_Engdeg=C3=A5rd?= <mattias.engdegard@HIDDEN>
In-Reply-To: <0e13de8a-ab0c-404d-9d93-d3756abcfa43@HIDDEN>
Date: Sun, 10 Mar 2024 17:46:59 +0100
Content-Transfer-Encoding: quoted-printable
Message-Id: <E3500800-AADA-433F-BEB5-4A72F954A561@HIDDEN>
References: <D3DD6F8C-55EA-4602-8A8C-3CDD6252CBCB@HIDDEN>
 <def3403e-eae5-4363-8d83-ef7fea155bbe@HIDDEN>
 <0A9CE0FD-AE2D-462C-906D-567F331CC98B@HIDDEN>
 <0e13de8a-ab0c-404d-9d93-d3756abcfa43@HIDDEN>
To: Dmitry Gutov <dmitry@HIDDEN>
X-Mailer: Apple Mail (2.3654.120.0.1.15)
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 69709
Cc: 69709 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

10 mars 2024 kl. 17.03 skrev Dmitry Gutov <dmitry@HIDDEN>:

> That sounds more confusing, though (you drop the 'pred' argument, and =
the function changes behavior, possibly becoming slower too).

Is it really surprising that behaviour changes if you remove a =
previously-mandatory argument from a call without reading the =
documentation? It seems unlikely that this would happen by accident.





Information forwarded to bug-gnu-emacs@HIDDEN:
bug#69709; Package emacs. Full text available.

Message received at 69709 <at> debbugs.gnu.org:


Received: (at 69709) by debbugs.gnu.org; 10 Mar 2024 16:04:17 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Mar 10 12:04:17 2024
Received: from localhost ([127.0.0.1]:37755 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1rjLeq-0005VP-AZ
	for submit <at> debbugs.gnu.org; Sun, 10 Mar 2024 12:04:17 -0400
Received: from out4-smtp.messagingengine.com ([66.111.4.28]:50975)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <dmitry@HIDDEN>) id 1rjLen-0005Uy-7P
 for 69709 <at> debbugs.gnu.org; Sun, 10 Mar 2024 12:04:15 -0400
Received: from compute4.internal (compute4.nyi.internal [10.202.2.44])
 by mailout.nyi.internal (Postfix) with ESMTP id 4716C5C0052;
 Sun, 10 Mar 2024 12:03:33 -0400 (EDT)
Received: from mailfrontend1 ([10.202.2.162])
 by compute4.internal (MEProxy); Sun, 10 Mar 2024 12:03:33 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gutov.dev; h=cc
 :cc:content-transfer-encoding:content-type:content-type:date
 :date:from:from:in-reply-to:in-reply-to:message-id:mime-version
 :references:reply-to:subject:subject:to:to; s=fm3; t=1710086613;
 x=1710173013; bh=iReCDhY+qmvv228xs2uYHt+f4Y4sG+nRZlZq/QuxNDA=; b=
 DRllf6LPKginNlzSFReXPfhUQzYQaXVX6S8S/YAN5ucy3c6dUfU70OUHcRkLyaFN
 IlI3XzrHzdmopafLi/yuFicP+PW3WFkIDsPdX6Thl/ohX/BqaWEgvVn5Pu1dREbw
 t9KOnNqEqXv2nDNCmJR+ruLUfV54v68+y5AhCFdq1rn0MSvsi3bh9gRluXw1/gH2
 qrjJXTIHvR16aKKeEz7c8NEXI8c8zBxS+vO5o77rqezPfFweEf3J6B11Fz7wrUjZ
 M9MqGkCqxnw8qsONYlCx7XmnXWiylVotZrxiQRQVz4H83wMmLbCZVmkF60Q7eENN
 42WU/rN+naFirvIZwOf80g==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=
 messagingengine.com; h=cc:cc:content-transfer-encoding
 :content-type:content-type:date:date:feedback-id:feedback-id
 :from:from:in-reply-to:in-reply-to:message-id:mime-version
 :references:reply-to:subject:subject:to:to:x-me-proxy:x-me-proxy
 :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t=1710086613; x=
 1710173013; bh=iReCDhY+qmvv228xs2uYHt+f4Y4sG+nRZlZq/QuxNDA=; b=M
 cQO8lCjCaid0I0Q7mazvH6m14qpWEu7TQNyGUSB9MalMnYupHx1bVQ625kgbsVH9
 oe+YNgKYdlcVO3k5IAvtUZqu7UoAXtajar7+60BeZATr/1KD0T3e5sKaWP1f9U+6
 Z3VMHfuITNgNATaDCV982b2ZsRO/tOLHUl18f1KiFN2Y7hakY+vCZLNyd2xP+XtU
 3BSjj7QwmNOKcL1Nna27ubUMMr9h/lLOR311416+6JmIiUBHUtQPjSJMlhw8eLEq
 K0helsYIHUqdyUdOd29LI1qUj3r6/F5balQn75r3ml4IBV6LSxa7eIJ7IZN7I5/9
 gggSmmo1+a5V8P1D9Oh7A==
X-ME-Sender: <xms:1dntZQwgO4grPluHvc8I3vAHpP2GEEeo0iqPz1lfOIwHYAoXA_pshQ>
 <xme:1dntZUSJ_VqStL1QjDzRruVmYcX5_ciPOe4v1TCYV9DJ2wZyZCm-uRjkv491gY24t
 CiisLjhbx9cDBJU5q0>
X-ME-Received: <xmr:1dntZSXiVgHFrYSYgHl8JA9FnioTEKICHF5IBixD6U6EF6_IK-Zb6ipYFL73gdKsqNId>
X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrieelgdekgecutefuodetggdotefrodftvf
 curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu
 uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc
 fjughrpefkffggfgfuvfevfhfhjggtgfesthekredttddvjeenucfhrhhomhepffhmihht
 rhihucfiuhhtohhvuceoughmihhtrhihsehguhhtohhvrdguvghvqeenucggtffrrghtth
 gvrhhnpeegleefteekgffhvdfhtdegveevveetteegteevgeettdehhfdukeetheffueek
 keenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpegumh
 hithhrhiesghhuthhovhdruggvvh
X-ME-Proxy: <xmx:1dntZejzKnY4SiWHWbrocgqQz8tphhg1MqCAn5uddWpH_uTvWJc1lA>
 <xmx:1dntZSAOkC3ycqVfL9npxIUX-gpKvKcdxji6RoKcptlbLxTH1mdkJw>
 <xmx:1dntZfJfbRkY90C9t9lTst4HRAA51U7SPMgsHlufDlhcxgag6gCMnQ>
 <xmx:1dntZdo-TvXv64Qu_AG8RpqXOQrIXJMkMf9Z2Y11v2BXh1t7JSdsAA>
Feedback-ID: i0e71465a:Fastmail
Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sun,
 10 Mar 2024 12:03:32 -0400 (EDT)
Message-ID: <0e13de8a-ab0c-404d-9d93-d3756abcfa43@HIDDEN>
Date: Sun, 10 Mar 2024 18:03:31 +0200
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
Subject: Re: bug#69709: `sort` interface improvement and universal ordering
 predicate
Content-Language: en-US
To: =?UTF-8?Q?Mattias_Engdeg=C3=A5rd?= <mattias.engdegard@HIDDEN>
References: <D3DD6F8C-55EA-4602-8A8C-3CDD6252CBCB@HIDDEN>
 <def3403e-eae5-4363-8d83-ef7fea155bbe@HIDDEN>
 <0A9CE0FD-AE2D-462C-906D-567F331CC98B@HIDDEN>
From: Dmitry Gutov <dmitry@HIDDEN>
In-Reply-To: <0A9CE0FD-AE2D-462C-906D-567F331CC98B@HIDDEN>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 69709
Cc: 69709 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

On 10/03/2024 17:56, Mattias Engdegård wrote:
> 10 mars 2024 kl. 16.48 skrev Dmitry Gutov<dmitry@HIDDEN>:
> 
>> Here's a concern: a lot of existing code is written with either mutability in mind (the source list is a throwaway one, owned by the caller), or coupled with copy-sequence already.
>>
>> If the new 'sort' default to non-destructive, wouldn't that make those existing callsites slower? Or at least some of them.
> No, with the old calling convention they would get destructive (in-place) sorting. There should be no incompatibilities at all.

I see. That sounds more confusing, though (you drop the 'pred' argument, 
and the function changes behavior, possibly becoming slower too).




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#69709; Package emacs. Full text available.

Message received at 69709 <at> debbugs.gnu.org:


Received: (at 69709) by debbugs.gnu.org; 10 Mar 2024 15:58:23 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Mar 10 11:58:22 2024
Received: from localhost ([127.0.0.1]:37740 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1rjLZ7-0005IQ-A7
	for submit <at> debbugs.gnu.org; Sun, 10 Mar 2024 11:58:22 -0400
Received: from mail-lj1-f170.google.com ([209.85.208.170]:44461)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <mattias.engdegard@HIDDEN>) id 1rjLZ4-0005IB-5d
 for 69709 <at> debbugs.gnu.org; Sun, 10 Mar 2024 11:58:20 -0400
Received: by mail-lj1-f170.google.com with SMTP id
 38308e7fff4ca-2d220e39907so57547711fa.1
 for <69709 <at> debbugs.gnu.org>; Sun, 10 Mar 2024 08:57:44 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1710086199; x=1710690999; 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=J2zJslMpeNfcjcE8ItgwswuPBYnt58A9yl6ewOb4oyI=;
 b=HlabZ2s5KvLy4sprqLGiHSCoERvW/QIZXKpmjHYPsLcCUhQagEbwuSg49n8ar8tZnY
 RBti/upkAu3XnQN/TJA6VtW/e2lrZENo7zG/JTwEKIarENDjl0fE2beyuwOjEG6rK5Qi
 WuHBlyvyjZNyIatxK6jdKqyJtiAef6lUdvjpodNJ8hYOllVQyJO3dPrcQEBvGbjqGQAc
 Fn7iuBJNsH7H2cxAjyPCIgxqDOFvdYZcKzs9ENYNmgMmQ7euG/SoQ1+m4jjhdU9KcMwv
 uH5tfMljzez/Akq33PU8szWV5yXI90DsSmxMDhL9Yi1MaKWKaHTgew/FuApPoU1st8/v
 N7jw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1710086199; x=1710690999;
 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=J2zJslMpeNfcjcE8ItgwswuPBYnt58A9yl6ewOb4oyI=;
 b=EZXcAepkFMswgwGpMTcFfWWvYYSDsZfNJbBHpRKIA6ciR4w5YeJGhbfLMUuAh2Z3KI
 uTWTmw0QL03eYE3CLNdfbQhMtrOZ1z5bfsL80+QEFR5OCwe6gdtHrak6ZH3J4rfqscGt
 pTp2v94azGshHvtY5LWJThqnKdMue7I1Puy4cAH46whS6nbddggC/Ox5/vhn6v2g1rfN
 b/PY0JEgnMlqPAP+OqfHZ62ySyGZn+4oTd92uPoqdhsq/nnvSw4RLghQlvRvE5x4ur/H
 ZekJApBY8dKRJY14rDZZPBczk32CMr1Dzk2bDiPp3IeNu25ARr1raaoPhop0sCESvENa
 aY5w==
X-Gm-Message-State: AOJu0Yxs5t5G6cE4DUbXPi1mpthOIRFZdm9inBqoYi/kO+F0tofvlfXy
 0TggPKAKX8TPbTD/VuNUOZFZRRWJqnnHXdF5mrQdxU22DRBM1YQC
X-Google-Smtp-Source: AGHT+IGtwyHjR3bzp/k30xwiluP3Ka4oUyVez8zFx1SnmIbEkDcHykBfX9VGHasRy+5iBmnmm5z87Q==
X-Received: by 2002:a2e:be03:0:b0:2d2:2c28:f174 with SMTP id
 z3-20020a2ebe03000000b002d22c28f174mr3359410ljq.42.1710086198557; 
 Sun, 10 Mar 2024 08:56:38 -0700 (PDT)
Received: from smtpclient.apple (c80-217-1-132.bredband.tele2.se.
 [80.217.1.132]) by smtp.gmail.com with ESMTPSA id
 b14-20020a2e894e000000b002d43b2e5f3dsm139618ljk.38.2024.03.10.08.56.38
 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128);
 Sun, 10 Mar 2024 08:56:38 -0700 (PDT)
Content-Type: text/plain;
	charset=us-ascii
Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.120.0.1.15\))
Subject: Re: bug#69709: `sort` interface improvement and universal ordering
 predicate
From: =?utf-8?Q?Mattias_Engdeg=C3=A5rd?= <mattias.engdegard@HIDDEN>
In-Reply-To: <def3403e-eae5-4363-8d83-ef7fea155bbe@HIDDEN>
Date: Sun, 10 Mar 2024 16:56:37 +0100
Content-Transfer-Encoding: quoted-printable
Message-Id: <0A9CE0FD-AE2D-462C-906D-567F331CC98B@HIDDEN>
References: <D3DD6F8C-55EA-4602-8A8C-3CDD6252CBCB@HIDDEN>
 <def3403e-eae5-4363-8d83-ef7fea155bbe@HIDDEN>
To: Dmitry Gutov <dmitry@HIDDEN>
X-Mailer: Apple Mail (2.3654.120.0.1.15)
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 69709
Cc: 69709 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

10 mars 2024 kl. 16.48 skrev Dmitry Gutov <dmitry@HIDDEN>:

> Here's a concern: a lot of existing code is written with either =
mutability in mind (the source list is a throwaway one, owned by the =
caller), or coupled with copy-sequence already.
>=20
> If the new 'sort' default to non-destructive, wouldn't that make those =
existing callsites slower? Or at least some of them.

No, with the old calling convention they would get destructive =
(in-place) sorting. There should be no incompatibilities at all.





Information forwarded to bug-gnu-emacs@HIDDEN:
bug#69709; Package emacs. Full text available.

Message received at 69709 <at> debbugs.gnu.org:


Received: (at 69709) by debbugs.gnu.org; 10 Mar 2024 15:49:19 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Mar 10 11:49:19 2024
Received: from localhost ([127.0.0.1]:37736 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1rjLQN-00051E-3Y
	for submit <at> debbugs.gnu.org; Sun, 10 Mar 2024 11:49:19 -0400
Received: from out4-smtp.messagingengine.com ([66.111.4.28]:43707)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <dmitry@HIDDEN>) id 1rjLQK-00050N-Fc
 for 69709 <at> debbugs.gnu.org; Sun, 10 Mar 2024 11:49:17 -0400
Received: from compute5.internal (compute5.nyi.internal [10.202.2.45])
 by mailout.nyi.internal (Postfix) with ESMTP id C03365C0049;
 Sun, 10 Mar 2024 11:48:37 -0400 (EDT)
Received: from mailfrontend1 ([10.202.2.162])
 by compute5.internal (MEProxy); Sun, 10 Mar 2024 11:48:37 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gutov.dev; h=cc
 :content-transfer-encoding:content-type:content-type:date:date
 :from:from:in-reply-to:in-reply-to:message-id:mime-version
 :references:reply-to:subject:subject:to:to; s=fm3; t=1710085717;
 x=1710172117; bh=TEfyrcB3yogkQ6gCGD8glF1Kg5kAHoYG26IOpMnuaz4=; b=
 juFVkyH/f0l0tN9enI5fn5nPImjNViVVxyq/SMJgnUC1cdNgvHk3p91WQC/7bg39
 M1wD9n6/l9rL+0bpiim+YB7ypHyuhk2nIbbBL4BRiRB+H2IYlbQMKQJRV4Iwuq7z
 qbyGoXYk8iC/sFUGMuRg5KfkdH6Ym1HkxLiKexLgsOjdk5g4zfEFhHuVrP9iE50x
 KdE47gNPywEulkPFYxxf/Wq83ilh2sYm82AHUV6ezo4lWlkWLAeBHcZaoZ+k8d+D
 JnSnELVXGws/bT75gUSk+POa1nD0bl3HwYdxIl5rvJI4oR6/oFkvxJwUvrHu/fcW
 SHxvnTNAfP6iYUdgkaqCRA==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=
 messagingengine.com; h=cc:content-transfer-encoding:content-type
 :content-type:date:date:feedback-id:feedback-id:from:from
 :in-reply-to:in-reply-to:message-id:mime-version:references
 :reply-to:subject:subject:to:to:x-me-proxy:x-me-proxy
 :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t=1710085717; x=
 1710172117; bh=TEfyrcB3yogkQ6gCGD8glF1Kg5kAHoYG26IOpMnuaz4=; b=Z
 YN2CYuqNAU021BsiNZajR3nDC/TuYmvKQltMufdiJDVZaR7CTD6jSdxlgva1HDoa
 2xgJhuer7Zqz0Hjja9TMs8u0dVIxbvIHOBDY5G0LitNSwkbyjeCaL2Me55iOaZCX
 QsHVJtb/AxKeq6KlMomj/dS7lUvRcqyhPfAhO2rDGdsUnMtqFycQ3pNIAHi9U0/q
 nmRj34ar2HWdMf53xMo3KDMuRpgyE/7v42Ye31ScBE+ntStOR6CjIk3EpvvbV134
 XOtfqR8fA/53Iuiv0WwdAaaqrGxihP3CKUjvIteEKmSWZ7o2Q1K+jXqjVUgR4jmj
 4t/+RdOTqOKTX5Y2ES1Jg==
X-ME-Sender: <xms:VdbtZYi7ZiV5-NybFNYQB6V0SzVx02_oZ33I3B4YCNuEBK85bOgAoQ>
 <xme:VdbtZRAlkFId863rQi2MF1NMMdNtVHA5PoD-zoTuLFuL4TDVCukz7DO0WOwNtlidS
 lEjKz6-hwFT9htiWRc>
X-ME-Received: <xmr:VdbtZQGAzKr_0rmqkfn5JrIWnM5EpdFs_NxCnHG-7ZFCEEMCcFxPWrAG8n-HkoVUJZND>
X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrieelgdektdcutefuodetggdotefrodftvf
 curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu
 uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc
 fjughrpefkffggfgfuvfhfhfgjtgfgsehtkeertddtvdejnecuhfhrohhmpeffmhhithhr
 hicuifhuthhovhcuoegumhhithhrhiesghhuthhovhdruggvvheqnecuggftrfgrthhtvg
 hrnhepgeeugeetffduvdejvedvleeliedtfedtudfhfeefffejudekveejvdeffffgveeg
 necuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepughmih
 htrhihsehguhhtohhvrdguvghv
X-ME-Proxy: <xmx:VdbtZZTS4pfU2v-73XSPel9DiZnDUbbJaSkJj-oOfm0SmIbBgb1BCg>
 <xmx:VdbtZVxleClG0-4oA8Vw_im51Mjg2abKiQ-eg_USRbzzO92dpiORvA>
 <xmx:VdbtZX5sCo3naJ9dLWswXzePb98DrawcN3y1AUWV6aHewSQNBwDIgg>
 <xmx:VdbtZTY8T08Ddbg6v5MdkK9UfrWVsI1QSCMgvxjfQHZBIAhflhh59A>
Feedback-ID: i0e71465a:Fastmail
Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sun,
 10 Mar 2024 11:48:36 -0400 (EDT)
Message-ID: <def3403e-eae5-4363-8d83-ef7fea155bbe@HIDDEN>
Date: Sun, 10 Mar 2024 17:48:34 +0200
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
Subject: Re: bug#69709: `sort` interface improvement and universal ordering
 predicate
Content-Language: en-US
To: =?UTF-8?Q?Mattias_Engdeg=C3=A5rd?= <mattias.engdegard@HIDDEN>,
 69709 <at> debbugs.gnu.org
References: <D3DD6F8C-55EA-4602-8A8C-3CDD6252CBCB@HIDDEN>
From: Dmitry Gutov <dmitry@HIDDEN>
In-Reply-To: <D3DD6F8C-55EA-4602-8A8C-3CDD6252CBCB@HIDDEN>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 69709
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

On 10/03/2024 15:28, Mattias Engdegård wrote:
> 2. Mutability by default is a bug magnet as well.
> 
> To deal with the first problem, we could:
> 
> * Add a universal ordering predicate that will compare two values of the
>   same type for many built-in types: numbers, strings, symbols, markers,
> lists, vectors, records, and a few more.
> * Make this ordering the default.
> * Add a key (accessor) function argument, like that in the recent
> `sort-on` interface, but built-in. This is important.
> 
> These work very well together: the user does not need to write or even
> choose an ordering predicate in most cases. Key functions are much less
> error-prone to write, and with the lexicographic ordering of lists,
> vectors and records, multi-key sorting is made much easier.
> 
> A key function combined with a standard ordering can also be used to
> optimise comparisons since we have all key values up front along with
> how they should be compared. The original timsort code that we stole
> from Python did this.
> 
> As a starting point, a patch implementing a universal ordering predicate
>   is attached below.
> 
> The proposed sorting function interface would be
> 
>    (new-sort seq &key key lessp destructive)

Here's a concern: a lot of existing code is written with either 
mutability in mind (the source list is a throwaway one, owned by the 
caller), or coupled with copy-sequence already.

If the new 'sort' default to non-destructive, wouldn't that make those 
existing callsites slower? Or at least some of them.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#69709; Package emacs. Full text available.

Message received at 69709 <at> debbugs.gnu.org:


Received: (at 69709) by debbugs.gnu.org; 10 Mar 2024 14:58:10 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Mar 10 10:58:10 2024
Received: from localhost ([127.0.0.1]:37692 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1rjKcp-0003YW-0I
	for submit <at> debbugs.gnu.org; Sun, 10 Mar 2024 10:58:10 -0400
Received: from mail-lf1-f48.google.com ([209.85.167.48]:59780)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <mattias.engdegard@HIDDEN>) id 1rjKcl-0003Xy-Rd
 for 69709 <at> debbugs.gnu.org; Sun, 10 Mar 2024 10:58:05 -0400
Received: by mail-lf1-f48.google.com with SMTP id
 2adb3069b0e04-513a08f2263so767505e87.3
 for <69709 <at> debbugs.gnu.org>; Sun, 10 Mar 2024 07:57:30 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1710082584; x=1710687384; 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=pzGAFai88D1fXW4Ir1VEyaeM9OhE/3MX7v4mj3GAdcI=;
 b=YRNZQ4JFM5ik4pSlatGE/7pWfKoN/j9ZkcdTqHYvuSuFTIQABWssBc2O5bQpbfpK04
 qruG9R1277lg9tiznexbtz4vreb7q5nt7CZUr4X61kSqVZSC9YVhh8XGhzVwzFV82cuR
 KtxQsYWRs8gY6dD7aGnFp28lQ98GBT2QNtw9sxxkPAgjGRbocpZzOmKkB5mKsjnlEzJE
 87veVUP5fGWq/vlCflKFDtu7bHab42E1XzddjX+a7BNiyphovNmUdjvjbMKgfGrd4gff
 S0fZttyynn85Wzufp3ZW0/LsrDILRtTj5bN5rSz4NyPTrTMc1eXKQ4kQwOCEVB2Jpwdg
 hP5w==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1710082584; x=1710687384;
 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=pzGAFai88D1fXW4Ir1VEyaeM9OhE/3MX7v4mj3GAdcI=;
 b=seGY5M9Mch0IfOVsTbsH8oVU+cOIiRpsLdadDMXUTDVKBZcg623emi4dPo9s9zAjKX
 aBoY1hNfMD9bM3pCTg2ja6tae1gqJLxVcpqy2DLGdJFyj5/aw/VybYOQDgauBj0CEwTg
 dqsKuZ5FpQWIj+Pbcl8faB/NdRIxLPDE+faUfMNLuTnhTnlLnKKtikSQEiCoJvpj+oYT
 xFm8RPqQrOm1xPG1VXIRrCa3pNkXqp/N3qzwjSp0Pa9g4rWYMyePlYQm5n9uPz58Mnst
 NdED4hbvKyNjovo+5jzrRcd+nJTyGEaKxuT6sWbeUCF0yQ9urZhQx1AoaEH1jTSW4rSk
 p10A==
X-Forwarded-Encrypted: i=1;
 AJvYcCWcbpDggLk4ePMwu2K1YzLziAAeDVCOYDdy3HYJ44e0CjIH6W4NyAy0Z1MlErBbAMJF3jWOkWoRr8vC7fucmLg+mPKve9M=
X-Gm-Message-State: AOJu0Yy2edOPjCzFIjz+jmcVWrdgydJt2kSs87gbc2s/bCCC6HXpSP9u
 eloX7JcgxcIwZjymEt4AJSszYpPQ3xUfjsOQu/W1Z8frWWPRkXwG
X-Google-Smtp-Source: AGHT+IHV7gsPPe1XmZT7qR0Vb4XzlfoOJDmueYhxo5D0Dido/VbjYBrClmykm8b0fCcOwX8TSGo84w==
X-Received: by 2002:a05:6512:360a:b0:512:bb33:2eab with SMTP id
 f10-20020a056512360a00b00512bb332eabmr2333210lfs.58.1710082584312; 
 Sun, 10 Mar 2024 07:56:24 -0700 (PDT)
Received: from smtpclient.apple (c80-217-1-132.bredband.tele2.se.
 [80.217.1.132]) by smtp.gmail.com with ESMTPSA id
 p28-20020a056512313c00b005131c6f2eb5sm685458lfd.114.2024.03.10.07.56.23
 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128);
 Sun, 10 Mar 2024 07:56:24 -0700 (PDT)
Content-Type: text/plain;
	charset=us-ascii
Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.120.0.1.15\))
Subject: Re: bug#69709: `sort` interface improvement and universal ordering
 predicate
From: =?utf-8?Q?Mattias_Engdeg=C3=A5rd?= <mattias.engdegard@HIDDEN>
In-Reply-To: <86zfv6uqjn.fsf@HIDDEN>
Date: Sun, 10 Mar 2024 15:56:23 +0100
Content-Transfer-Encoding: quoted-printable
Message-Id: <4391448A-C7AF-4D7F-8866-C0313956D52D@HIDDEN>
References: <D3DD6F8C-55EA-4602-8A8C-3CDD6252CBCB@HIDDEN>
 <86zfv6uqjn.fsf@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
X-Mailer: Apple Mail (2.3654.120.0.1.15)
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 69709
Cc: 69709 <at> debbugs.gnu.org, Stefan Monnier <monnier@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

10 mars 2024 kl. 15.09 skrev Eli Zaretskii <eliz@HIDDEN>:

> A nit: let's go with a name that doesn't have "new" as part of it.

Sorry, that was meant as a placeholder. I should have used a more =
obvious non-name.

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

Yes, `sort-on` would be completely subsumed by the new interface.

> And what about performance?

Existing code should see little or no change. Users of the new interface =
would probably see performance improvements. You should trust me on =
neither of these points until there is actual code.

However the performance of the universal predicate seems fine, and is =
definitely better than hand-writing a predicate in Lisp when applicable.





Information forwarded to bug-gnu-emacs@HIDDEN:
bug#69709; Package emacs. Full text available.

Message received at 69709 <at> debbugs.gnu.org:


Received: (at 69709) by debbugs.gnu.org; 10 Mar 2024 14:12:27 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Mar 10 10:12:27 2024
Received: from localhost ([127.0.0.1]:37669 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1rjJud-00082k-CP
	for submit <at> debbugs.gnu.org; Sun, 10 Mar 2024 10:12:27 -0400
Received: from eggs.gnu.org ([209.51.188.92]:59002)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1rjJub-00082Y-Op
 for 69709 <at> debbugs.gnu.org; Sun, 10 Mar 2024 10:12:26 -0400
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 <eliz@HIDDEN>)
 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==;
Date: Sun, 10 Mar 2024 16:09:32 +0200
Message-Id: <86zfv6uqjn.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Mattias =?utf-8?Q?Engdeg=C3=A5rd?= <mattias.engdegard@HIDDEN>,
 Stefan Monnier <monnier@HIDDEN>
In-Reply-To: <D3DD6F8C-55EA-4602-8A8C-3CDD6252CBCB@HIDDEN> (message from
 Mattias =?utf-8?Q?Engdeg=C3=A5rd?= on Sun, 10 Mar 2024 14:28:02 +0100)
Subject: Re: bug#69709: `sort` interface improvement and universal ordering
 predicate
References: <D3DD6F8C-55EA-4602-8A8C-3CDD6252CBCB@HIDDEN>
MIME-version: 1.0
Content-type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 69709
Cc: 69709 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> From: Mattias Engdegård <mattias.engdegard@HIDDEN>
> 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.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#69709; Package emacs. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 10 Mar 2024 13:28:45 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Mar 10 09:28:45 2024
Received: from localhost ([127.0.0.1]:35771 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1rjJEL-0006P4-1e
	for submit <at> debbugs.gnu.org; Sun, 10 Mar 2024 09:28:45 -0400
Received: from lists.gnu.org ([209.51.188.17]:60182)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <mattias.engdegard@HIDDEN>) id 1rjJEI-0006Ov-6R
 for submit <at> debbugs.gnu.org; Sun, 10 Mar 2024 09:28:43 -0400
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 <mattias.engdegard@HIDDEN>)
 id 1rjJDk-0007zn-KC
 for bug-gnu-emacs@HIDDEN; Sun, 10 Mar 2024 09:28:08 -0400
Received: from mail-lj1-x22e.google.com ([2a00:1450:4864:20::22e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <mattias.engdegard@HIDDEN>)
 id 1rjJDi-0004cQ-SE
 for bug-gnu-emacs@HIDDEN; Sun, 10 Mar 2024 09:28:08 -0400
Received: by mail-lj1-x22e.google.com with SMTP id
 38308e7fff4ca-2d3fb16f1a9so45886221fa.0
 for <bug-gnu-emacs@HIDDEN>; Sun, 10 Mar 2024 06:28:06 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1710077284; x=1710682084; darn=gnu.org;
 h=to:date:message-id:subject:mime-version:from:sender:from:to:cc
 :subject:date:message-id:reply-to;
 bh=G+zUP0PaYfX56OdRB4bCbjPCrmBsCG9kB90rVyd2nB4=;
 b=NtcFWA6xJXnY/HEouuiTZXdj7P/NxhdV4eB/2QQQ/v2jW9kwD89ESpmX6sYUwVTcZw
 EQeuoq7/I4AYQTK9aA7WGBqw3FlOQI2XLq4iisTDEJY6oeXsPpKms3pFuRSiquBSVFRd
 ED2lMbLyuzVboEeQ+UAxtMyJPrkILNJXSqNbMpU5U7cj0ihheLHCUP/3mH61Ez4InP1p
 ku+n8fuBcj3JwjakqiLNvlXO28NBFxMM0QGfBZbsXmp9KrW4fOsJqwCt8Z+0eL0yyXXC
 MkQfEP20sQjRcAtNy08+SWs13oQpmh0X3nRNPInlwzK+fcZCqy2cGvX98L9dZUhDnAUa
 V3WQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1710077284; x=1710682084;
 h=to:date:message-id:subject:mime-version:from:sender
 :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to;
 bh=G+zUP0PaYfX56OdRB4bCbjPCrmBsCG9kB90rVyd2nB4=;
 b=GfcxhJhITop2SFxMo/KSeTm3YusDFyVQV9/RGfU3NMLKVOMrUOQJeopAuFCNM0AE+6
 43Pnrhnk04qKogVbW4zejgBG/Ce2z45HDZUmjPyjDnWdveihQkrD/I1O9nHIDQLZoiss
 k2GQo5BS02tTwYsf9zfGh724/br2amGmVVcCPvqKwPTn3UV7BjCTwj7F0Os4p1XEmjns
 7+CXkIJ7riN7cuBesd61+WA8Jpb06pbM67cim/eM5AOlUmQNvsk7VB3NQoEZHtj16Eji
 V68v7j6RseMpMJ95L8XVQhkYo1so+nM8tw+0pUgj0t+lqKEvaBfOAd3ueLiDc0NdF81e
 phIw==
X-Gm-Message-State: AOJu0Yx8hsZXaH/XKWG3f7Q0PyEzRMr3zTJDbwIjVIo8SHeI0cIUlHri
 tgV4NBh/Xa1Ztuhdb1UJSoRg3RFVz5NOelNyQpGqHQoG8f4H7MNRBw6FxfoW
X-Google-Smtp-Source: AGHT+IH9K6+shuy3g9gVwoImQ0J6EQk1SZUxZm0vI/ZT0Ek8xHUxX7MpAYBl4jCMoFyiw4NsN+sxZg==
X-Received: by 2002:a2e:2e06:0:b0:2d4:1302:4657 with SMTP id
 u6-20020a2e2e06000000b002d413024657mr1673668lju.17.1710077283767; 
 Sun, 10 Mar 2024 06:28:03 -0700 (PDT)
Received: from smtpclient.apple (c80-217-1-132.bredband.tele2.se.
 [80.217.1.132]) by smtp.gmail.com with ESMTPSA id
 by10-20020a05651c1a0a00b002d2aa0b0d01sm669374ljb.82.2024.03.10.06.28.03
 for <bug-gnu-emacs@HIDDEN>
 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128);
 Sun, 10 Mar 2024 06:28:03 -0700 (PDT)
From: =?utf-8?Q?Mattias_Engdeg=C3=A5rd?= <mattias.engdegard@HIDDEN>
Content-Type: multipart/mixed;
 boundary="Apple-Mail=_851F0DC0-20B0-4A64-958C-2AA810381534"
Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.120.0.1.15\))
Subject: `sort` interface improvement and universal ordering predicate
Message-Id: <D3DD6F8C-55EA-4602-8A8C-3CDD6252CBCB@HIDDEN>
Date: Sun, 10 Mar 2024 14:28:02 +0100
To: Emacs Bug Report <bug-gnu-emacs@HIDDEN>
X-Mailer: Apple Mail (2.3654.120.0.1.15)
Received-SPF: pass client-ip=2a00:1450:4864:20::22e;
 envelope-from=mattias.engdegard@HIDDEN; helo=mail-lj1-x22e.google.com
X-Spam_score_int: -20
X-Spam_score: -2.1
X-Spam_bar: --
X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,
 DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001,
 RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001,
 T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: -1.3 (-)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -2.3 (--)


--Apple-Mail=_851F0DC0-20B0-4A64-958C-2AA810381534
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;
	charset=us-ascii

The existing `sort` interface suffers from some usability problems:

1. Writing an ordering predicate is often difficult and error-prone, =
even for very basic tasks such as selecting the field to sort on. It's =
not uncommon to botch a predicate as simple as

  (lambda (a b) (< (f a) (f b)))

which I've managed to do myself more than once. It gets particularly =
messy when sorting on multiple fields.
Having to write a custom comparison function for almost every occasion =
also means that performance suffers.

2. Mutability by default is a bug magnet as well.

To deal with the first problem, we could:

* Add a universal ordering predicate that will compare two values of the =
same type for many built-in types: numbers, strings, symbols, markers, =
lists, vectors, records, and a few more.
* Make this ordering the default.
* Add a key (accessor) function argument, like that in the recent =
`sort-on` interface, but built-in. This is important.

These work very well together: the user does not need to write or even =
choose an ordering predicate in most cases. Key functions are much less =
error-prone to write, and with the lexicographic ordering of lists, =
vectors and records, multi-key sorting is made much easier.

A key function combined with a standard ordering can also be used to =
optimise comparisons since we have all key values up front along with =
how they should be compared. The original timsort code that we stole =
from Python did this.

As a starting point, a patch implementing a universal ordering predicate =
is attached below.

The proposed sorting function interface would be

  (new-sort seq &key key lessp destructive)

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.


--Apple-Mail=_851F0DC0-20B0-4A64-958C-2AA810381534
Content-Disposition: attachment;
	filename=0001-value-less-p.patch
Content-Type: application/octet-stream;
	x-unix-mode=0644;
	name="0001-value-less-p.patch"
Content-Transfer-Encoding: quoted-printable

=46rom=206980c8cf54a23eddf97ecf4881e43f9a49a18a55=20Mon=20Sep=2017=20=
00:00:00=202001=0AFrom:=20=3D?UTF-8?q?Mattias=3D20Engdeg=3DC3=3DA5rd?=3D=20=
<mattiase@HIDDEN>=0ADate:=20Sun,=2010=20Mar=202024=2013:18:22=20+0100=0A=
Subject:=20[PATCH]=20value-less-p=0A=0A---=0A=20src/data.c=20=20=20=20=20=
=20=20=20=20=20=20=20|=20=20=202=20+=0A=20src/fns.c=20=20=20=20=20=20=20=20=
=20=20=20=20=20|=20226=20++++++++++++++++++++++++++++++++++++++++++=0A=20=
test/src/fns-tests.el=20|=20122=20+++++++++++++++++++++++=0A=203=20files=20=
changed,=20350=20insertions(+)=0A=0Adiff=20--git=20a/src/data.c=20=
b/src/data.c=0Aindex=20df08eaf8102..8f3ba6438b9=20100644=0A---=20=
a/src/data.c=0A+++=20b/src/data.c=0A@@=20-4039,6=20+4039,7=20@@=20=
syms_of_data=20(void)=0A=20=20=20DEFSYM=20(Qminibuffer_quit,=20=
"minibuffer-quit");=0A=20=20=20DEFSYM=20(Qwrong_length_argument,=20=
"wrong-length-argument");=0A=20=20=20DEFSYM=20(Qwrong_type_argument,=20=
"wrong-type-argument");=0A+=20=20DEFSYM=20(Qtype_mismatch,=20=
"type-mismatch")=0A=20=20=20DEFSYM=20(Qargs_out_of_range,=20=
"args-out-of-range");=0A=20=20=20DEFSYM=20(Qvoid_function,=20=
"void-function");=0A=20=20=20DEFSYM=20(Qcyclic_function_indirection,=20=
"cyclic-function-indirection");=0A@@=20-4130,6=20+4131,7=20@@=20#define=20=
PUT_ERROR(sym,=20tail,=20msg)=09=09=09\=0A=20=20=20PUT_ERROR=20=
(Quser_error,=20error_tail,=20"");=0A=20=20=20PUT_ERROR=20=
(Qwrong_length_argument,=20error_tail,=20"Wrong=20length=20argument");=0A=
=20=20=20PUT_ERROR=20(Qwrong_type_argument,=20error_tail,=20"Wrong=20=
type=20argument");=0A+=20=20PUT_ERROR=20(Qtype_mismatch,=20error_tail,=20=
"Types=20do=20not=20match");=0A=20=20=20PUT_ERROR=20(Qargs_out_of_range,=20=
error_tail,=20"Args=20out=20of=20range");=0A=20=20=20PUT_ERROR=20=
(Qvoid_function,=20error_tail,=0A=20=09=20=20=20=20=20"Symbol's=20=
function=20definition=20is=20void");=0Adiff=20--git=20a/src/fns.c=20=
b/src/fns.c=0Aindex=200a64e515402..cc017839996=20100644=0A---=20=
a/src/fns.c=0A+++=20b/src/fns.c=0A@@=20-27,6=20+27,7=20@@=20Copyright=20=
(C)=201985-2024=20Free=20Software=20Foundation,=20Inc.=0A=20#include=20=
<vla.h>=0A=20#include=20<errno.h>=0A=20#include=20<ctype.h>=0A+#include=20=
<math.h>=0A=20=0A=20#include=20"lisp.h"=0A=20#include=20"bignum.h"=0A@@=20=
-2908,6=20+2909,230=20@@=20internal_equal=20(Lisp_Object=20o1,=20=
Lisp_Object=20o2,=20enum=20equal_kind=20equal_kind,=0A=20=0A=20=20=20=
return=20false;=0A=20}=0A+=0A+=0A+/*=20Return=20-1,=200=20or=201=20to=20=
indicate=20whether=20a<b,=20a=3Db=20or=20a>b=20in=20the=20sense=0A+=20=20=
=20of=20value-less-p.=0A+=20=20=20In=20particular=200=20does=20not=20=
mean=20equality=20in=20the=20sense=20of=20Fequal,=20only=0A+=20=20=20=
that=20the=20arguments=20cannot=20be=20ordered=20yet=20they=20can=20be=20=
compared=20(same=0A+=20=20=20type).=0A+=0A+=20=20=20If=20lessp_only=20is=20=
true,=20then=20we=20may=20return=200=20instead=20of=201=20when=20a>b,=0A=
+=20=20=20if=20this=20is=20faster.=20=20*/=0A+static=20int=0A=
+value_less_p=20(Lisp_Object=20a,=20Lisp_Object=20b,=20int=20maxdepth,=20=
bool=20lessp_only)=0A+{=0A+=20=20if=20(maxdepth=20<=200)=0A+=20=20=20=20=
error=20("Maximum=20depth=20exceeded=20in=20comparison");=0A+=0A+=20=
tail_recurse:=0A+=20=20/*=20Shortcut=20for=20a=20common=20case.=20=20*/=0A=
+=20=20if=20(BASE_EQ=20(a,=20b))=0A+=20=20=20=20return=200;=0A+=0A+=20=20=
switch=20(XTYPE=20(a))=0A+=20=20=20=20{=0A+=20=20=20=20case_Lisp_Int:=0A=
+=20=20=20=20=20=20{=0A+=09EMACS_INT=20ia=20=3D=20XFIXNUM=20(a);=0A+=09=
if=20(FIXNUMP=20(b))=0A+=09=20=20return=20ia=20<=20XFIXNUM=20(b)=20?=20=
-1=20:=20ia=20>=20XFIXNUM=20(b);=0A+=09if=20(FLOATP=20(b))=0A+=09=20=20=
return=20ia=20<=20XFLOAT_DATA=20(b)=20?=20-1=20:=20ia=20>=20XFLOAT_DATA=20=
(b);=0A+=09if=20(BIGNUMP=20(b))=0A+=09=20=20return=20-mpz_sgn=20=
(*xbignum_val=20(b));=0A+=20=20=20=20=20=20}=0A+=20=20=20=20=20=20goto=20=
type_mismatch;=0A+=0A+=20=20=20=20case=20Lisp_Symbol:=0A+=20=20=20=20=20=20=
if=20(BARE_SYMBOL_P=20(b))=0A+=09{=0A+=09=20=20struct=20Lisp_Symbol=20=
*sa=20=3D=20XBARE_SYMBOL=20(a);=0A+=09=20=20struct=20Lisp_Symbol=20*sb=20=
=3D=20XBARE_SYMBOL=20(b);=0A+=09=20=20if=20(!NILP=20(Fstring_lessp=20=
(sa->u.s.name,=20sb->u.s.name)))=0A+=09=20=20=20=20return=20-1;=0A+=09=20=
=20if=20(lessp_only)=0A+=09=20=20=20=20return=200;=0A+=09=20=20if=20=
(sa->u.s.interned=20=3D=3D=20SYMBOL_INTERNED_IN_INITIAL_OBARRAY=0A+=09=20=
=20=20=20=20=20&&=20sb->u.s.interned=20=3D=3D=20=
SYMBOL_INTERNED_IN_INITIAL_OBARRAY)=0A+=09=20=20=20=20/*=20Both=20=
symbols=20are=20interned=20in=20the=20initial=20obarray,=20so=20cannot=20=
have=0A+=09=20=20=20=20=20=20=20equal=20names.=20=20*/=0A+=09=20=20=20=20=
return=201;=0A+=09=20=20return=20NILP=20(Fequal=20(sa->u.s.name,=20=
sb->u.s.name));=0A+=09}=0A+=20=20=20=20=20=20if=20(CONSP=20(b)=20&&=20=
NILP=20(a))=0A+=09return=20-1;=0A+=20=20=20=20=20=20if=20(SYMBOLP=20(b))=0A=
+=09{=0A+=09=20=20/*=20Slow-path=20branch=20when=20B=20is=20a=20=
symbol-with-pos.=20=20*/=0A+=09=20=20if=20(!NILP=20(Fstring_lessp=20(a,=20=
b)))=0A+=09=20=20=20=20return=20-1;=0A+=09=20=20if=20(lessp_only)=0A+=09=20=
=20=20=20return=200;=0A+=09=20=20return=20NILP=20(Fequal=20(a,=20b));=0A=
+=09}=0A+=20=20=20=20=20=20goto=20type_mismatch;=0A+=0A+=20=20=20=20case=20=
Lisp_String:=0A+=20=20=20=20=20=20if=20(STRINGP=20(b))=0A+=09{=0A+=09=20=20=
if=20(!NILP=20(Fstring_lessp=20(a,=20b)))=0A+=09=20=20=20=20return=20-1;=0A=
+=09=20=20/*=20FIXME:=20We=20would=20go=20even=20faster,=20and=20=
wouldn't=20need=20the=0A+=09=20=20=20=20=20lessp_only=20hack,=20if=20we=20=
had=20a=20string=20comparison=20with=20-1/0/1=20result.=0A+=09=20=20=20=20=
=20Generalise=20the=20code=20in=20Fstring_lessp=20for=20internal=20use?=20=
=20*/=0A+=09=20=20if=20(lessp_only)=0A+=09=20=20=20=20return=200;=0A+=09=20=
=20return=20NILP=20(Fequal=20(a,=20b));=0A+=09}=0A+=20=20=20=20=20=20=
goto=20type_mismatch;=0A+=0A+=20=20=20=20case=20Lisp_Cons:=0A+=20=20=20=20=
=20=20while=20(CONSP=20(b))=0A+=09{=0A+=09=20=20int=20cmp=20=3D=20=
value_less_p=20(XCAR=20(a),=20XCAR=20(b),=20maxdepth=20-=201,=20false);=0A=
+=09=20=20if=20(cmp=20!=3D=200)=0A+=09=20=20=20=20return=20cmp;=0A+=09=20=
=20a=20=3D=20XCDR=20(a);=0A+=09=20=20b=20=3D=20XCDR=20(b);=0A+=09=20=20=
if=20(!CONSP=20(a))=0A+=09=20=20=20=20break;=0A+=09}=0A+=20=20=20=20=20=20=
if=20(CONSP=20(a))=0A+=09{=0A+=09=20=20if=20(NILP=20(b))=0A+=09=20=20=20=20=
return=201;=0A+=09=20=20else=0A+=09=20=20=20=20goto=20type_mismatch;=0A+=09=
}=0A+=20=20=20=20=20=20goto=20tail_recurse;=0A+=0A+=20=20=20=20case=20=
Lisp_Vectorlike:=0A+=20=20=20=20=20=20if=20(VECTORLIKEP=20(b))=0A+=09{=0A=
+=09=20=20enum=20pvec_type=20ta=20=3D=20PSEUDOVECTOR_TYPE=20(XVECTOR=20=
(a));=0A+=09=20=20enum=20pvec_type=20tb=20=3D=20PSEUDOVECTOR_TYPE=20=
(XVECTOR=20(b));=0A+=09=20=20if=20(ta=20=3D=3D=20tb)=0A+=09=20=20=20=20=
switch=20(ta)=0A+=09=20=20=20=20=20=20{=0A+=09=20=20=20=20=20=20case=20=
PVEC_NORMAL_VECTOR:=0A+=09=20=20=20=20=20=20case=20PVEC_RECORD:=0A+=09=09=
{=0A+=09=09=20=20ptrdiff_t=20len_a=20=3D=20ASIZE=20(a);=0A+=09=09=20=20=
ptrdiff_t=20len_b=20=3D=20ASIZE=20(b);=0A+=09=09=20=20if=20(ta=20=3D=3D=20=
PVEC_RECORD)=0A+=09=09=20=20=20=20{=0A+=09=09=20=20=20=20=20=20len_a=20=
&=3D=20PSEUDOVECTOR_SIZE_MASK;=0A+=09=09=20=20=20=20=20=20len_b=20&=3D=20=
PSEUDOVECTOR_SIZE_MASK;=0A+=09=09=20=20=20=20}=0A+=09=09=20=20ptrdiff_t=20=
len_min=20=3D=20min=20(len_a,=20len_b);=0A+=09=09=20=20for=20(ptrdiff_t=20=
i=20=3D=200;=20i=20<=20len_min;=20i++)=0A+=09=09=20=20=20=20{=0A+=09=09=20=
=20=20=20=20=20int=20cmp=20=3D=20value_less_p=20(AREF=20(a,=20i),=20AREF=20=
(b,=20i),=0A+=09=09=09=09=09=20=20=20=20=20=20maxdepth=20-=201,=20=
false);=0A+=09=09=20=20=20=20=20=20if=20(cmp=20!=3D=200)=0A+=09=09=09=
return=20cmp;=0A+=09=09=20=20=20=20}=0A+=09=09=20=20return=20len_a=20<=20=
len_b=20?=20-1=20:=20len_a=20>=20len_b;=0A+=09=09}=0A+=0A+=09=20=20=20=20=
=20=20case=20PVEC_BOOL_VECTOR:=0A+=09=09{=0A+=09=09=20=20ptrdiff_t=20=
len_a=20=3D=20bool_vector_size=20(a);=0A+=09=09=20=20ptrdiff_t=20len_b=20=
=3D=20bool_vector_size=20(b);=0A+=09=09=20=20ptrdiff_t=20len_min=20=3D=20=
min=20(len_a,=20len_b);=0A+=09=09=20=20/*=20FIXME:=20very=20inefficient,=20=
we=20could=20compare=20words.=20=20*/=0A+=09=09=20=20for=20(ptrdiff_t=20=
i=20=3D=200;=20i=20<=20len_min;=20i++)=0A+=09=09=20=20=20=20{=0A+=09=09=20=
=20=20=20=20=20bool=20ai=20=3D=20bool_vector_bitref=20(a,=20i);=0A+=09=09=
=20=20=20=20=20=20bool=20bi=20=3D=20bool_vector_bitref=20(b,=20i);=0A+=09=
=09=20=20=20=20=20=20if=20(ai=20!=3D=20bi)=0A+=09=09=09return=20bi=20?=20=
-1=20:=20ai;=0A+=09=09=20=20=20=20}=0A+=09=09=20=20return=20len_a=20<=20=
len_b=20?=20-1=20:=20len_a=20>=20len_b;=0A+=09=09}=0A+=0A+=09=20=20=20=20=
=20=20case=20PVEC_MARKER:=0A+=09=09{=0A+=09=09=20=20Lisp_Object=20buf_a=20=
=3D=20Fmarker_buffer=20(a);=0A+=09=09=20=20Lisp_Object=20buf_b=20=3D=20=
Fmarker_buffer=20(b);=0A+=09=09=20=20if=20(NILP=20(buf_a))=0A+=09=09=20=20=
=20=20return=20NILP=20(buf_b)=20?=200=20:=20-1;=0A+=09=09=20=20if=20=
(NILP=20(buf_b))=0A+=09=09=20=20=20=20return=201;=0A+=09=09=20=20int=20=
cmp=20=3D=20value_less_p=20(buf_a,=20buf_b,=20maxdepth=20-=201,=20=
false);=0A+=09=09=20=20if=20(cmp=20!=3D=200)=0A+=09=09=20=20=20=20return=20=
cmp;=0A+=09=09=20=20ptrdiff_t=20pa=20=3D=20XMARKER=20(a)->charpos;=0A+=09=
=09=20=20ptrdiff_t=20pb=20=3D=20XMARKER=20(b)->charpos;=0A+=09=09=20=20=
return=20pa=20<=20pb=20?=20-1=20:=20pa=20>=20pb;=0A+=09=09}=0A+=0A+=09=20=
=20=20=20=20=20case=20PVEC_PROCESS:=0A+=09=09return=20value_less_p=20=
(Fprocess_name=20(a),=20Fprocess_name=20(b),=0A+=09=09=09=09=20=20=20=20=20=
maxdepth=20-=201,=20lessp_only);=0A+=09=20=20=20=20=20=20case=20=
PVEC_BUFFER:=0A+=09=09{=0A+=09=09=20=20/*=20Killed=20buffers=20lack=20=
names=20and=20sort=20before=20those=20alive.=20=20*/=0A+=09=09=20=20=
Lisp_Object=20na=20=3D=20Fbuffer_name=20(a);=0A+=09=09=20=20Lisp_Object=20=
nb=20=3D=20Fbuffer_name=20(b);=0A+=09=09=20=20if=20(NILP=20(na))=0A+=09=09=
=20=20=20=20return=20NILP=20(nb)=20?=200=20:=20-1;=0A+=09=09=20=20if=20=
(NILP=20(nb))=0A+=09=09=20=20=20=20return=201;=0A+=09=09=20=20return=20=
value_less_p=20(na,=20nb,=20maxdepth=20-=201,=20lessp_only);=0A+=09=09}=0A=
+=0A+=09=20=20=20=20=20=20case=20PVEC_BIGNUM:=0A+=09=09return=20mpz_cmp=20=
(*xbignum_val=20(a),=20*xbignum_val=20(b));=0A+=0A+=09=20=20=20=20=20=20=
default:=0A+=09=09/*=20Treat=20other=20types=20as=20unordered.=20=20*/=0A=
+=09=09return=200;=0A+=09=20=20=20=20=20=20}=0A+=09}=0A+=20=20=20=20=20=20=
else=20if=20(BIGNUMP=20(a))=0A+=09return=20-value_less_p=20(b,=20a,=20=
maxdepth,=20false);=0A+=20=20=20=20=20=20goto=20type_mismatch;=0A+=0A+=20=
=20=20=20case=20Lisp_Float:=0A+=20=20=20=20=20=20{=0A+=09double=20fa=20=3D=
=20XFLOAT_DATA=20(a);=0A+=09if=20(FLOATP=20(b))=0A+=09=20=20return=20fa=20=
<=20XFLOAT_DATA=20(b)=20?=20-1=20:=20fa=20>=20XFLOAT_DATA=20(b);=0A+=09=
if=20(FIXNUMP=20(b))=0A+=09=20=20return=20fa=20<=20XFIXNUM=20(b)=20?=20=
-1=20:=20fa=20>=20XFIXNUM=20(b);=0A+=09if=20(BIGNUMP=20(b))=0A+=09=20=20=
{=0A+=09=20=20=20=20if=20(isnan=20(fa))=0A+=09=20=20=20=20=20=20return=20=
0;=0A+=09=20=20=20=20return=20-mpz_cmp_d=20(*xbignum_val=20(b),=20fa);=0A=
+=09=20=20}=0A+=20=20=20=20=20=20}=0A+=20=20=20=20=20=20goto=20=
type_mismatch;=0A+=0A+=20=20=20=20default:=0A+=20=20=20=20=20=20eassume=20=
(0);=0A+=20=20=20=20}=0A+=20type_mismatch:=0A+=20=20xsignal2=20=
(Qtype_mismatch,=20a,=20b);=0A+}=0A+=0A+DEFUN=20("value-less-p",=20=
Fvalue_less_p,=20Svalue_less_p,=202,=202,=200,=0A+=20=20=20=20=20=20=20=
doc:=20/*=20Return=20non-nil=20if=20A=20precedes=20B=20in=20standard=20=
value=20order.=0A+A=20and=20B=20must=20have=20the=20same=20basic=20type.=0A=
+Numbers=20are=20compared=20with=20`<'.=0A+Strings=20and=20symbols=20are=20=
compared=20with=20`string-lessp'.=0A+Lists,=20vectors,=20bool-vectors=20=
and=20records=20are=20compared=20lexicographically.=0A+Markers=20are=20=
compared=20lexicographically=20by=20buffer=20and=20position.=0A+Buffers=20=
and=20processes=20are=20compared=20by=20name.=0A+Other=20types=20are=20=
considered=20unordered=20and=20the=20return=20value=20will=20be=20`nil'.=20=
=20*/)=0A+=20=20(Lisp_Object=20a,=20Lisp_Object=20b)=0A+{=0A+=20=20int=20=
maxdepth=20=3D=2020;=09=09=20=20/*=20FIXME:=20arbitrary=20value=20*/=0A+=20=
=20return=20value_less_p=20(a,=20b,=20maxdepth,=20true)=20<=200=20?=20Qt=20=
:=20Qnil;=0A+}=0A+=0A=20=0C=0A=20=0A=20DEFUN=20("fillarray",=20=
Ffillarray,=20Sfillarray,=202,=202,=200,=0A@@=20-6589,6=20+6814,7=20@@=20=
syms_of_fns=20(void)=0A=20=20=20defsubr=20(&Seql);=0A=20=20=20defsubr=20=
(&Sequal);=0A=20=20=20defsubr=20(&Sequal_including_properties);=0A+=20=20=
defsubr=20(&Svalue_less_p);=0A=20=20=20defsubr=20(&Sfillarray);=0A=20=20=20=
defsubr=20(&Sclear_string);=0A=20=20=20defsubr=20(&Snconc);=0Adiff=20=
--git=20a/test/src/fns-tests.el=20b/test/src/fns-tests.el=0Aindex=20=
7437c07f156..f81b1eadd09=20100644=0A---=20a/test/src/fns-tests.el=0A+++=20=
b/test/src/fns-tests.el=0A@@=20-1513,4=20+1513,126=20@@=20=
fns--copy-alist=0A=20=20=20(should-error=20(copy-alist=20"abc")=0A=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20:type=20'wrong-type-argument))=0A=
=20=0A+(ert-deftest=20fns-value-less-p-ordered=20()=0A+=20=20;;=20values=20=
(X=20.=20Y)=20where=20X<Y=0A+=20=20(let*=20((big=20(*=2010=20=
most-positive-fixnum))=0A+=20=20=20=20=20=20=20=20=20(buf1=20=
(get-buffer-create=20"=20*one*"))=0A+=20=20=20=20=20=20=20=20=20(buf2=20=
(get-buffer-create=20"=20*two*"))=0A+=20=20=20=20=20=20=20=20=20(_=20=
(progn=20(with-current-buffer=20buf1=20(insert=20(make-string=2020=20=
?a)))=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
(with-current-buffer=20buf2=20(insert=20(make-string=2020=20?b)))))=0A+=20=
=20=20=20=20=20=20=20=20(mark1=20(set-marker=20(make-marker)=2012=20=
buf1))=0A+=20=20=20=20=20=20=20=20=20(mark2=20(set-marker=20=
(make-marker)=2013=20buf1))=0A+=20=20=20=20=20=20=20=20=20(mark3=20=
(set-marker=20(make-marker)=2012=20buf2))=0A+=20=20=20=20=20=20=20=20=20=
(mark4=20(set-marker=20(make-marker)=2013=20buf2))=0A+=20=20=20=20=20=20=20=
=20=20(proc1=20(make-pipe-process=20:name=20"=20*proc=20one*"))=0A+=20=20=
=20=20=20=20=20=20=20(proc2=20(make-pipe-process=20:name=20"=20*proc=20=
two*")))=0A+=20=20=20=20(unwind-protect=0A+=20=20=20=20=20=20=20=20=
(dolist=20(c=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20`(=0A=
+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20;;=20fixnums=0A=
+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20(1=20.=202)=20=20=
(-2=20.=20-1)=20(-2=20.=201)=20(-1=20.=202)=0A+=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20;;=20bignums=0A+=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20(,big=20.=20,(1+=20big))=20(,(-=20big)=20.=20=
,big)=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20(,(-=20=
-1=20big)=20.=20,(-=20big))=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20;;=20fixnums/bignums=0A+=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20(1=20.=20,big)=20(-1=20.=20,big)=20(,(-=20big)=20.=20=
-1)=20(,(-=20big)=20.=201)=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20;;=20floats=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20(1.5=20.=201.6)=20(-1.3=20.=20-1.2)=20(-13.0=20.=2012.0)=0A+=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20;;=20floats/fixnums=0A=
+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20(1=20.=201.1)=20=
(1.9=20.=202)=20(-2.0=20.=201)=20(-2=20.=201.0)=0A+=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20;;=20floats/bignums=0A+=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20(,big=20.=20,(float=20(*=202=20=
big)))=20(,(float=20big)=20.=20,(*=202=20big))=0A+=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20;;=20symbols=0A+=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20(a=20.=20b)=20(nil=20.=20nix)=20(b=20.=20=
ba)=20(##=20.=20a)=20(A=20.=20a)=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20(#:a=20.=20#:b)=20(a=20.=20#:b)=20(#:a=20.=20b)=0A+=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20;;=20strings=0A+=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20(""=20.=20"a")=20("a"=20=
.=20"b")=20("A"=20.=20"a")=20("abc"=20.=20"abd")=0A+=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20("b"=20.=20"ba")=0A+=0A+=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20;;=20lists=0A+=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20((1=202=203)=20.=20(2=203=204))=20=
((2)=20.=20(2=201))=20(()=20.=20(0))=0A+=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20((1=202=203)=20.=20(1=203))=20((1=202=203)=20.=20=
(1=203=202))=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
(((b=20a)=20(c=20d)=20e)=20.=20((b=20a)=20(c=20d)=20f))=0A+=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20(((b=20a)=20(c=20D)=20e)=20.=20=
((b=20a)=20(c=20d)=20e))=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20(((b=20a)=20(c=20d=20()=20x)=20e)=20.=20((b=20a)=20(c=20d=20=
(1)=20x)=20e))=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
((1=20.=202)=20.=20(1=20.=203))=20((1=202=20.=203)=20.=20(1=202=20.=20=
4))=0A+=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20;;=20=
vectors=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20([1=20=
2=203]=20.=20[2=203=204])=20([2]=20.=20[2=201])=20([]=20.=20[0])=0A+=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20([1=202=203]=20.=20[1=20=
3])=20([1=202=203]=20.=20[1=203=202])=0A+=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20([[b=20a]=20[c=20d]=20e]=20.=20[[b=20a]=20[c=20=
d]=20f])=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
([[b=20a]=20[c=20D]=20e]=20.=20[[b=20a]=20[c=20d]=20e])=0A+=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20([[b=20a]=20[c=20d=20[]=20x]=20=
e]=20.=20[[b=20a]=20[c=20d=20[1]=20x]=20e])=0A+=0A+=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20;;=20bool-vectors=0A+=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20(,(bool-vector)=20.=20,(bool-vector=20=
nil))=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
(,(bool-vector=20nil)=20.=20,(bool-vector=20t))=0A+=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20(,(bool-vector=20t=20nil=20t=20nil)=20.=20=
,(bool-vector=20t=20nil=20t=20t))=0A+=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20(,(bool-vector=20t=20nil=20t)=20.=20,(bool-vector=20=
t=20nil=20t=20nil))=0A+=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20;;=20records=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20(#s(a=202=203)=20.=20#s(b=203=204))=20(#s(b)=20.=20#s(b=20a))=0A=
+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20(#s(a=202=203)=20=
.=20#s(a=203))=20(#s(a=202=203)=20.=20#s(a=203=202))=0A+=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20(#s(#s(b=20a)=20#s(c=20d)=20e)=20=
.=20#s(#s(b=20a)=20#s(c=20d)=20f))=0A+=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20(#s(#s(b=20a)=20#s(c=20D)=20e)=20.=20#s(#s(b=20a)=20=
#s(c=20d)=20e))=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20(#s(#s(b=20a)=20#s(c=20d=20#s(u)=20x)=20e)=0A+=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20.=20#s(#s(b=20a)=20#s(c=20d=20#s(v)=20=
x)=20e))=0A+=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
;;=20markers=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
(,mark1=20.=20,mark2)=20(,mark1=20.=20,mark3)=20(,mark1=20.=20,mark4)=0A=
+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20(,mark2=20.=20=
,mark3)=20(,mark2=20.=20,mark4)=20(,mark3=20.=20,mark4)=0A+=0A+=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20;;=20buffers=0A+=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20(,buf1=20.=20,buf2)=0A+=0A+=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20;;=20processes=0A+=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20(,proc1=20.=20=
,proc2)=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20))=0A=
+=20=20=20=20=20=20=20=20=20=20(let=20((x=20(car=20c))=0A+=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20(y=20(cdr=20c)))=0A+=20=20=20=20=20=20=20=
=20=20=20=20=20(should=20(value-less-p=20x=20y))=0A+=20=20=20=20=20=20=20=
=20=20=20=20=20(should-not=20(value-less-p=20y=20x))=0A+=20=20=20=20=20=20=
=20=20=20=20=20=20(should-not=20(value-less-p=20x=20x))=0A+=20=20=20=20=20=
=20=20=20=20=20=20=20(should-not=20(value-less-p=20y=20y))))=0A+=0A+=20=20=
=20=20=20=20(delete-process=20proc2)=0A+=20=20=20=20=20=20=
(delete-process=20proc1)=0A+=20=20=20=20=20=20(kill-buffer=20buf2)=0A+=20=
=20=20=20=20=20(kill-buffer=20buf1))))=0A+=0A+(ert-deftest=20=
fns-value-less-p-unordered=20()=0A+=20=20;;=20values=20(X=20.=20Y)=20=
where=20neither=20X<Y=20nor=20Y<X=0A+=20=20(dolist=20(c=20`(=0A+=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20;;=20numbers=0A+=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20(0=20.=200.0)=20(0=20.=20-0.0)=20(0.0=20.=20=
-0.0)=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20;;=20symbols=0A+=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20(a=20.=20#:a)=0A+=0A+=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20;;=20unordered=20types=0A+=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20(,(make-hash-table)=20.=20=
,(make-hash-table))=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
(,(obarray-make)=20.=20,(obarray-make))=0A+=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20;;=20FIXME:=20more?=0A+=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20))=0A+=20=20=20=20(let=20((x=20(car=20c))=0A+=20=20=20=20=20=20=20=
=20=20=20(y=20(cdr=20c)))=0A+=20=20=20=20=20=20(should-not=20=
(value-less-p=20x=20y))=0A+=20=20=20=20=20=20(should-not=20(value-less-p=20=
y=20x)))))=0A+=0A+(ert-deftest=20fns-value-less-p-type-mismatch=20()=0A+=20=
=20;;=20values=20of=20disjoint=20(incomparable)=20types=0A+=20=20(let=20=
((incomparable=0A+=20=20=20=20=20=20=20=20=20`(=201=20a=20"a"=20(a=20b)=20=
[a=20b]=20,(bool-vector=20nil=20t)=20#s(a=20b)=0A+=20=20=20=20=20=20=20=20=
=20=20=20=20,(make-char-table=20'test)=0A+=20=20=20=20=20=20=20=20=20=20=20=
=20,(make-hash-table)=0A+=20=20=20=20=20=20=20=20=20=20=20=20=
,(obarray-make)=0A+=20=20=20=20=20=20=20=20=20=20=20=20;;=20FIXME:=20=
more?=0A+=20=20=20=20=20=20=20=20=20=20=20=20)))=0A+=20=20=20=20(let=20=
((tail=20incomparable))=0A+=20=20=20=20=20=20(while=20tail=0A+=20=20=20=20=
=20=20=20=20(let=20((x=20(car=20tail)))=0A+=20=20=20=20=20=20=20=20=20=20=
(dolist=20(y=20(cdr=20tail))=0A+=20=20=20=20=20=20=20=20=20=20=20=20=
(should-error=20(value-less-p=20x=20y)=20:type=20'type-mismatch)=0A+=20=20=
=20=20=20=20=20=20=20=20=20=20(should-error=20(value-less-p=20y=20x)=20=
:type=20'type-mismatch)))=0A+=20=20=20=20=20=20=20=20(setq=20tail=20(cdr=20=
tail))))))=0A+=0A=20;;;=20fns-tests.el=20ends=20here=0A--=20=0A2.32.0=20=
(Apple=20Git-132)=0A=0A=

--Apple-Mail=_851F0DC0-20B0-4A64-958C-2AA810381534
Content-Transfer-Encoding: 7bit
Content-Type: text/plain;
	charset=us-ascii





--Apple-Mail=_851F0DC0-20B0-4A64-958C-2AA810381534--




Acknowledgement sent to Mattias Engdegård <mattias.engdegard@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to bug-gnu-emacs@HIDDEN:
bug#69709; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Sun, 14 Apr 2024 16:30:04 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.