GNU bug report logs - #55395
What does (1 2 3 . #2) mean?

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 <mattiase@HIDDEN>; dated Fri, 13 May 2022 11:41:01 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.

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


Received: (at 55395) by debbugs.gnu.org; 18 May 2022 14:30:06 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed May 18 10:30:06 2022
Received: from localhost ([127.0.0.1]:33149 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1nrKgf-0004Wz-OS
	for submit <at> debbugs.gnu.org; Wed, 18 May 2022 10:30:06 -0400
Received: from mail1446c50.megamailservers.eu ([91.136.14.46]:44332
 helo=mail265c50.megamailservers.eu)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <mattiase@HIDDEN>) id 1nrKgd-0004Ts-1C
 for 55395 <at> debbugs.gnu.org; Wed, 18 May 2022 10:30:04 -0400
X-Authenticated-User: mattiase@HIDDEN
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=megamailservers.eu;
 s=maildub; t=1652884196;
 bh=AkoR2KV03hTvXBXqJUSLGLi0/mBk6TCyBF4Pc/iYBRg=;
 h=From:Subject:Date:In-Reply-To:Cc:To:References:From;
 b=IiQhb9wOumxZVxRBDSnY4TBSYmvGXZ+Pke4alygp/MKkdw3+P/AjQ/iz8MxpclXWC
 7fdd68lygqi5ZD8FSq0D2Vcoe4GHvv73F1SYAAq7v4RM0j/cTue9HketiSlk48Mxbn
 tGLMtIeHObLrZfOWJY/fgUFTqbSqFOVHeZnbtXIM=
Feedback-ID: mattiase@HIDDEN
Received: from smtpclient.apple (c188-150-171-71.bredband.tele2.se
 [188.150.171.71]) (authenticated bits=0)
 by mail265c50.megamailservers.eu (8.14.9/8.13.1) with ESMTP id 24IETqMf005775; 
 Wed, 18 May 2022 14:29:54 +0000
From: =?utf-8?Q?Mattias_Engdeg=C3=A5rd?= <mattiase@HIDDEN>
Message-Id: <86345ABE-C19C-4096-8550-05E5B78D6C3A@HIDDEN>
Content-Type: multipart/mixed;
 boundary="Apple-Mail=_9C60AD69-423C-4E73-823B-DAA20C4ABAB0"
Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.120.0.1.13\))
Subject: Re: bug#55395: What does (1 2 3 . #2) mean?
Date: Wed, 18 May 2022 16:29:51 +0200
In-Reply-To: <jwvpmkgfd88.fsf-monnier+emacs@HIDDEN>
To: Stefan Monnier <monnier@HIDDEN>
References: <4B70C9BE-B784-4B74-A081-7A8B3F8D5136@HIDDEN>
 <87ilq931ay.fsf@HIDDEN> <jwvee0xjqys.fsf-monnier+emacs@HIDDEN>
 <715F3D50-7D11-47CF-A34B-6532F1F508D7@HIDDEN>
 <jwvpmkgfd88.fsf-monnier+emacs@HIDDEN>
X-Mailer: Apple Mail (2.3654.120.0.1.13)
X-CTCH-RefID: str=0001.0A742F1B.628502E4.000E, ss=1, re=0.000, recu=0.000,
 reip=0.000, cl=1, cld=1, fgs=0
X-CTCH-VOD: Unknown
X-CTCH-Spam: Unknown
X-CTCH-Score: 0.000
X-CTCH-Rules: 
X-CTCH-Flags: 0
X-CTCH-ScoreCust: 0.000
X-Origin-Country: SE
X-Spam-Score: 1.3 (+)
X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 the administrator of that system for details.
 Content preview: 14 maj 2022 kl. 15.45 skrev Stefan Monnier
 <monnier@HIDDEN>:
 > I do have the impression that it used to be "correct", but I can't > remember
 of a single time where I actually made use of that NNN. > > And even if you
 know what it means and it works correctly, i [...] 
 Content analysis details:   (1.3 points, 10.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 0.0 SPF_HELO_NONE          SPF: HELO does not publish an SPF Record
 1.0 SPF_SOFTFAIL           SPF: sender does not match SPF record (softfail)
 -0.0 T_SCC_BODY_TEXT_LINE   No description available.
 0.3 KHOP_HELO_FCRDNS       Relay HELO differs from its IP's reverse DNS
X-Debbugs-Envelope-To: 55395
Cc: 55395 <at> debbugs.gnu.org, Lars Ingebrigtsen <larsi@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: -0.0 (/)


--Apple-Mail=_9C60AD69-423C-4E73-823B-DAA20C4ABAB0
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;
	charset=us-ascii

14 maj 2022 kl. 15.45 skrev Stefan Monnier <monnier@HIDDEN>:

> I do have the impression that it used to be "correct", but I can't
> remember of a single time where I actually made use of that NNN.
>=20
> And even if you know what it means and it works correctly, it's pretty
> hard for a normal human to correctly count the depth starting from
> the root.

It is. Counting upwards from a leaf seems slightly easier.

Perhaps these attempts to generate a meaningful circularity reference is =
a fool's errand and we should just go with #!circle! or something =
similar.

Anyway, I'm attaching a patch that tries to put some meaning back in the =
` . #N` notation: it's an index into the same list, as it used to be, I =
think, prior to the switch from Floyd to Brent. This is done by keeping =
track of the index of the tortoise at all times, which isn't very =
expensive at all.

Without the patch: (rho 4 1) =3D> (1 2 3 4 5 5 5 . #3)
With the patch:    (rho 4 1) =3D> (1 2 3 4 5 5 5 . #6)

which should be a mild improvement.
It's still ambiguous:

 (1 1 . #1)

could mean either

 #1=3D(1 . #1#)

or

 #1=3D(1 1 . #1#)

and

 [(1 2 3 . #0)]

could mean either

 [#1=3D(1 2 3 . #1#)]

or
 #1=3D[(1 2 3 . #1#)]

but maybe it's less wrong, with room for future improvement?


--Apple-Mail=_9C60AD69-423C-4E73-823B-DAA20C4ABAB0
Content-Disposition: attachment;
	filename=circular-list-print-index.diff
Content-Type: application/octet-stream;
	x-unix-mode=0644;
	name="circular-list-print-index.diff"
Content-Transfer-Encoding: 7bit

diff --git a/src/print.c b/src/print.c
index da4869e8fb..823bc07406 100644
--- a/src/print.c
+++ b/src/print.c
@@ -2028,12 +2028,12 @@ named_escape (int i)
   union {
     struct {
       Lisp_Object last;		/* cons whose car was just printed  */
-      ptrdiff_t idx;		/* index of next element */
-      intmax_t maxlen;		/* max length (from Vprint_length) */
+      intmax_t maxlen;		/* max number of elements left to print */
       /* state for Brent cycle detection */
       Lisp_Object tortoise;     /* slow pointer */
       ptrdiff_t n;		/* tortoise step countdown */
       ptrdiff_t m;		/* tortoise step period */
+      ptrdiff_t tortoise_idx;	/* index of tortoise */
     } list;
     struct {
       Lisp_Object obj;		/* object to print after " . " */
@@ -2408,10 +2408,10 @@ print_object (Lisp_Object obj, Lisp_Object printcharfun, bool escapeflag)
 		  .type = PE_list,
 		  .u.list.last = obj,
 		  .u.list.maxlen = print_length,
-		  .u.list.idx = 1,
 		  .u.list.tortoise = obj,
 		  .u.list.n = 2,
 		  .u.list.m = 2,
+		  .u.list.tortoise_idx = 0,
 		});
 	      /* print the car */
 	      obj = XCAR (obj);
@@ -2582,10 +2582,8 @@ print_object (Lisp_Object obj, Lisp_Object printcharfun, bool escapeflag)
 
 		printchar (' ', printcharfun);
 
-		/* FIXME: We wouldn't need to keep track of idx if we
-		   count down maxlen instead, and maintain a separate
-		   tortoise index if required.  */
-		if (e->u.list.idx >= e->u.list.maxlen)
+		--e->u.list.maxlen;
+		if (e->u.list.maxlen <= 0)
 		  {
 		    print_c_string ("...)", printcharfun);
 		    --prstack.sp;
@@ -2594,22 +2592,21 @@ print_object (Lisp_Object obj, Lisp_Object printcharfun, bool escapeflag)
 		  }
 
 		e->u.list.last = next;
-		e->u.list.idx++;
 		e->u.list.n--;
 		if (e->u.list.n == 0)
 		  {
 		    /* Double tortoise update period and teleport it.  */
+		    e->u.list.tortoise_idx += e->u.list.m;
 		    e->u.list.m <<= 1;
 		    e->u.list.n = e->u.list.m;
 		    e->u.list.tortoise = next;
 		  }
 		else if (BASE_EQ (next, e->u.list.tortoise))
 		  {
-		    /* FIXME: This #N tail index is bug-compatible with
-		       previous implementations but actually nonsense;
+		    /* FIXME: This #N tail index is somewhat ambiguous;
 		       see bug#55395.  */
 		    int len = sprintf (buf, ". #%" PRIdMAX ")",
-				       (e->u.list.idx >> 1) - 1);
+				       e->u.list.tortoise_idx);
 		    strout (buf, len, len, printcharfun);
 		    --prstack.sp;
 		    --print_depth;

--Apple-Mail=_9C60AD69-423C-4E73-823B-DAA20C4ABAB0--




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

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


Received: (at 55395) by debbugs.gnu.org; 14 May 2022 13:45:36 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat May 14 09:45:36 2022
Received: from localhost ([127.0.0.1]:46031 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1nps5Q-0007Js-1M
	for submit <at> debbugs.gnu.org; Sat, 14 May 2022 09:45:36 -0400
Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:12220)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <monnier@HIDDEN>) id 1nps5O-0007JZ-4y
 for 55395 <at> debbugs.gnu.org; Sat, 14 May 2022 09:45:34 -0400
Received: from pmg2.iro.umontreal.ca (localhost.localdomain [127.0.0.1])
 by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 3BAD880065;
 Sat, 14 May 2022 09:45:28 -0400 (EDT)
Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1])
 by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 96656802A7;
 Sat, 14 May 2022 09:45:22 -0400 (EDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca;
 s=mail; t=1652535922;
 bh=5HYecQlFK+ohrzXZNHpqPPKcuPA0/Rylr2KceMMZ6Eo=;
 h=From:To:Cc:Subject:References:Date:In-Reply-To:From;
 b=geEDekDqsUYREKX+xLfhXWAjVUryBT4EJYw9Rx5RhDmL77ANv8X1z74mzcI4Vkvan
 KV0lE+pjckvNLavXFqBfojoXztQ5OS+cz9o3MWFfmnN+FH2dEZXSL2taEPKZ69febf
 oQCYk8JzvCMDxTB+MUaj9KuPBOkUNP+UVzjwU5QW8suML9OwCiVGq3ldzlvtkdPwSf
 4BCFnjNqkljt+ycz+BfQpjpMqaQecMjUZFdfkVkQaXKsQwBCZXfKSHCmZlflo79JBY
 SBinpdbYuuxssdn+c1ib5j4MMrVRCJ9+IbFQkR/ApTMrj+J0bn2fc+BFXJLZmfsOrV
 1Nc7HzGAek4Eg==
Received: from alfajor (modemcable034.207-20-96.mc.videotron.ca [96.20.207.34])
 by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 692D81208BF;
 Sat, 14 May 2022 09:45:22 -0400 (EDT)
From: Stefan Monnier <monnier@HIDDEN>
To: Mattias =?windows-1252?Q?Engdeg=E5rd?= <mattiase@HIDDEN>
Subject: Re: bug#55395: What does (1 2 3 . #2) mean?
Message-ID: <jwvpmkgfd88.fsf-monnier+emacs@HIDDEN>
References: <4B70C9BE-B784-4B74-A081-7A8B3F8D5136@HIDDEN>
 <87ilq931ay.fsf@HIDDEN> <jwvee0xjqys.fsf-monnier+emacs@HIDDEN>
 <715F3D50-7D11-47CF-A34B-6532F1F508D7@HIDDEN>
Date: Sat, 14 May 2022 09:45:15 -0400
In-Reply-To: <715F3D50-7D11-47CF-A34B-6532F1F508D7@HIDDEN> ("Mattias
 =?windows-1252?Q?Engdeg=E5rd=22's?= message of "Fri, 13 May 2022 22:01:44
 +0200")
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)
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.099 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 T_SCC_BODY_TEXT_LINE    -0.01 -
X-SPAM-LEVEL: 
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 55395
Cc: 55395 <at> debbugs.gnu.org, Lars Ingebrigtsen <larsi@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 (---)

>> The main goal is to avoid inf-looping and the #NNN chosen is
>> somewhat arbitrary.
> It seems to have sort-of worked before and was broken, inadvertently and
> with the best intentions, by a later change.
>
> Additionally the #N value appears to be correct for other object types. For example,
>
>   [a [b #1=[[c #1# d]]]]
>
> is printed as
>
>   [a [b [[c #2 d]]]]
>
> which is consistent with the manual.

I do have the impression that it used to be "correct", but I can't
remember of a single time where I actually made use of that NNN.

And even if you know what it means and it works correctly, it's pretty
hard for a normal human to correctly count the depth starting from
the root.

I suspect if we want to "do better", printing "the beginning" of the
object to which we're looping (and saying explicitly that there's
a cycle) will be a lot more useful to the average user.
[ Or we could even print "the period" rather than "the beginning".  ]

>> I'm personally more bothered by the fact that those #NNN use exactly the
>> same syntax as used with `print-circle` yet they don't have the
>> same semantics.
> The syntax isn't exactly the same (#N vs #N= and #N#) but annoyingly close.

Indeed, it's not as bad as I remembered.

> For that matter I would have preferred numbering the other way, starting at
> the bottom going up, like de Bruijn indices.

I love&hate de Bruijn indices as much as the next guy, but they're not
human-friendly (even more than the "like de Bruijn levels" we currently
use).


        Stefan





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

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


Received: (at 55395) by debbugs.gnu.org; 13 May 2022 20:01:53 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri May 13 16:01:53 2022
Received: from localhost ([127.0.0.1]:45116 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1npbU0-0001Ey-OJ
	for submit <at> debbugs.gnu.org; Fri, 13 May 2022 16:01:53 -0400
Received: from mail205c50.megamailservers.eu ([91.136.10.215]:53196
 helo=mail193c50.megamailservers.eu)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <mattiase@HIDDEN>) id 1npbTy-0001Bf-3l
 for 55395 <at> debbugs.gnu.org; Fri, 13 May 2022 16:01:51 -0400
X-Authenticated-User: mattiase@HIDDEN
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=megamailservers.eu;
 s=maildub; t=1652472107;
 bh=SIK8ZfzU00JmQULaXrktkc5EWc/gsj1VuBReHIO+9T0=;
 h=Subject:From:In-Reply-To:Date:Cc:References:To:From;
 b=Yr8wzci2nBxhwpey8ZTvWglYGyb81Eek9EZnSJW3Uv2h9PpAQ2mNHYybP1Gjq2Cb5
 dVCllGUteicnIBjgGubZDT/vttdCXqDp1edLX5eZMUL+TcmQLTo1o/Q3ZDlUvC/BNC
 Fem9AMB5ibZuS/nU6gto8F018+jNT02NfZKN94Yc=
Feedback-ID: mattiase@HIDDEN
Received: from smtpclient.apple (c188-150-171-71.bredband.tele2.se
 [188.150.171.71]) (authenticated bits=0)
 by mail193c50.megamailservers.eu (8.14.9/8.13.1) with ESMTP id 24DK1jKp021497; 
 Fri, 13 May 2022 20:01:47 +0000
Content-Type: text/plain;
	charset=us-ascii
Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.120.0.1.13\))
Subject: Re: bug#55395: What does (1 2 3 . #2) mean?
From: =?utf-8?Q?Mattias_Engdeg=C3=A5rd?= <mattiase@HIDDEN>
In-Reply-To: <jwvee0xjqys.fsf-monnier+emacs@HIDDEN>
Date: Fri, 13 May 2022 22:01:44 +0200
Content-Transfer-Encoding: quoted-printable
Message-Id: <715F3D50-7D11-47CF-A34B-6532F1F508D7@HIDDEN>
References: <4B70C9BE-B784-4B74-A081-7A8B3F8D5136@HIDDEN>
 <87ilq931ay.fsf@HIDDEN> <jwvee0xjqys.fsf-monnier+emacs@HIDDEN>
To: Stefan Monnier <monnier@HIDDEN>
X-Mailer: Apple Mail (2.3654.120.0.1.13)
X-CTCH-RefID: str=0001.0A742F17.627EB92B.00CB, ss=1, re=0.000, recu=0.000,
 reip=0.000, cl=1, cld=1, fgs=0
X-CTCH-VOD: Unknown
X-CTCH-Spam: Unknown
X-CTCH-Score: 0.000
X-CTCH-Rules: 
X-CTCH-Flags: 0
X-CTCH-ScoreCust: 0.000
X-Origin-Country: SE
X-Spam-Score: 0.3 (/)
X-Debbugs-Envelope-To: 55395
Cc: 55395 <at> debbugs.gnu.org, Lars Ingebrigtsen <larsi@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: -0.7 (/)

13 maj 2022 kl. 19.20 skrev Stefan Monnier <monnier@HIDDEN>:

> The main goal is to avoid inf-looping and the #NNN chosen is
> somewhat arbitrary.

It seems to have sort-of worked before and was broken, inadvertently and =
with the best intentions, by a later change.

Additionally the #N value appears to be correct for other object types. =
For example,

  [a [b #1=3D[[c #1# d]]]]

is printed as

  [a [b [[c #2 d]]]]

which is consistent with the manual.

> I don't think it's worth it to try and make those #NNN more precise.

I have a simple patch but it is not based on master so it will have to =
wait.

> I'm personally more bothered by the fact that those #NNN use exactly =
the
> same syntax as used with `print-circle` yet they don't have the
> same semantics.

The syntax isn't exactly the same (#N vs #N=3D and #N#) but annoyingly =
close.

For that matter I would have preferred numbering the other way, starting =
at the bottom going up, like de Bruijn indices. That way the numbering =
would be local and wouldn't depend on where the circular subtree occurs. =
Technically that would be an easy change, and if we agree that the =
numbers are unreliable right now, we might as well.





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

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


Received: (at 55395) by debbugs.gnu.org; 13 May 2022 19:54:44 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri May 13 15:54:44 2022
Received: from localhost ([127.0.0.1]:45112 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1npbN6-0007iV-0T
	for submit <at> debbugs.gnu.org; Fri, 13 May 2022 15:54:44 -0400
Received: from quimby.gnus.org ([95.216.78.240]:41256)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <larsi@HIDDEN>) id 1npbN4-0007iF-3m
 for 55395 <at> debbugs.gnu.org; Fri, 13 May 2022 15:54:42 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org;
 s=20200322; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date:
 References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding:
 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=3S5PTOedpkSDirGmAIUAjVt9cM6X6WliiYZmhZo02PE=; b=rdpE6KmXnOlWVEu/jJ6J1x3K4F
 RSge0iTvzkSqBKT16WaAZYb5iQM7nsTi8UgfNLJOIVXReuFnIC6ghU+0xg3O/+DpSAAhUH4DHu6K/
 9xghlQU3YevQhCmfOL1plJ3CdjObkdz5O4OgclGgzlICUFTqXlcC3jGkPAy5Xus4XTKc=;
Received: from [84.212.220.105] (helo=xo)
 by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.92) (envelope-from <larsi@HIDDEN>)
 id 1npbMt-00045H-F0; Fri, 13 May 2022 21:54:33 +0200
From: Lars Ingebrigtsen <larsi@HIDDEN>
To: Stefan Monnier <monnier@HIDDEN>
Subject: Re: bug#55395: What does (1 2 3 . #2) mean?
References: <4B70C9BE-B784-4B74-A081-7A8B3F8D5136@HIDDEN>
 <87ilq931ay.fsf@HIDDEN> <jwvee0xjqys.fsf-monnier+emacs@HIDDEN>
X-Now-Playing: Fairport Convention's _(guitar, vocal)_: "Sweet Little Rock
 'n' Roller"
Date: Fri, 13 May 2022 21:54:30 +0200
In-Reply-To: <jwvee0xjqys.fsf-monnier+emacs@HIDDEN> (Stefan Monnier's message
 of "Fri, 13 May 2022 13:20:51 -0400")
Message-ID: <87ee0xyzrd.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 @@CONTACT_ADDRESS@@ for details.
 Content preview:  Stefan Monnier <monnier@HIDDEN> writes: > Agreed
 (and agreed with Andreas as well). > The main goal is to avoid inf-looping
 and the #NNN chosen is > somewhat arbitrary. > > I don't think it's worth
 it to try and make those #NNN more precise [...] 
 Content analysis details:   (-2.9 points, 5.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 -1.0 ALL_TRUSTED            Passed through trusted hosts only via SMTP
 -1.9 BAYES_00               BODY: Bayes spam probability is 0 to 1%
 [score: 0.0000]
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 55395
Cc: 55395 <at> debbugs.gnu.org,
 Mattias =?utf-8?Q?Engdeg=C3=A5rd?= <mattiase@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 (---)

Stefan Monnier <monnier@HIDDEN> writes:

> Agreed (and agreed with Andreas as well).
> The main goal is to avoid inf-looping and the #NNN chosen is
> somewhat arbitrary.
>
> I don't think it's worth it to try and make those #NNN more precise.

So it seems like everybody basically agrees on that...  so if Mattias
wants to implement something here to give them some semantics, he can
pretty much choose whatever he wants?

Or just document that there's really no semantics here without
print-circle, if he prefers.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




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

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


Received: (at 55395) by debbugs.gnu.org; 13 May 2022 17:21:02 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri May 13 13:21:02 2022
Received: from localhost ([127.0.0.1]:44935 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1npYyM-0002jp-6A
	for submit <at> debbugs.gnu.org; Fri, 13 May 2022 13:21:02 -0400
Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:47384)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <monnier@HIDDEN>) id 1npYyK-0002iy-Dm
 for 55395 <at> debbugs.gnu.org; Fri, 13 May 2022 13:21:00 -0400
Received: from pmg2.iro.umontreal.ca (localhost.localdomain [127.0.0.1])
 by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 6B3AB806F8;
 Fri, 13 May 2022 13:20:54 -0400 (EDT)
Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1])
 by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 072EA80390;
 Fri, 13 May 2022 13:20:53 -0400 (EDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca;
 s=mail; t=1652462453;
 bh=wwl+HdjokZCX0CMorQ8lDP3LJUMuA9XXC6o0ZLOIezA=;
 h=From:To:Cc:Subject:References:Date:In-Reply-To:From;
 b=TtDybZ3FGCsI26a3Bg/IS80Rf5Duy+/d5CPyR8ajcHx9phoEeZa8WakaqQa2xjflH
 FDpML4JF3nEpbU5yycvUr28fgGXCM9YSw4P6Ca3yYsrZAV94/hhIMzbFFhfoBTCu+c
 pUL3/2fPNscO7JXz340DNj9pO4huU0ygtHybRSnuL/1dfLxmL6sHMWg0MJ8XZyF9s0
 KiDSjkE6s1bdD2mbZ0U+brOGhLKcUwd8j6dKffJ7xwGi/DG60I99/z72HL0ZRpINvn
 xUTzqzS9FjUGuLMeyxBqRlszx8UtyocTJaBrtbR950+l9lipore89UhGHchU5UK2dw
 D5+bpxp7lf49A==
Received: from pastel (unknown [45.72.221.51])
 by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 9CDAE120837;
 Fri, 13 May 2022 13:20:52 -0400 (EDT)
From: Stefan Monnier <monnier@HIDDEN>
To: Lars Ingebrigtsen <larsi@HIDDEN>
Subject: Re: bug#55395: What does (1 2 3 . #2) mean?
Message-ID: <jwvee0xjqys.fsf-monnier+emacs@HIDDEN>
References: <4B70C9BE-B784-4B74-A081-7A8B3F8D5136@HIDDEN>
 <87ilq931ay.fsf@HIDDEN>
Date: Fri, 13 May 2022 13:20:51 -0400
In-Reply-To: <87ilq931ay.fsf@HIDDEN> (Lars Ingebrigtsen's message of "Fri,
 13 May 2022 17:22:13 +0200")
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: quoted-printable
X-SPAM-INFO: Spam detection results:  0
 ALL_TRUSTED                -1 Passed through trusted hosts only via SMTP
 AWL -0.054 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 T_SCC_BODY_TEXT_LINE    -0.01 -
X-SPAM-LEVEL: 
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 55395
Cc: 55395 <at> debbugs.gnu.org,
 Mattias =?windows-1252?Q?Engdeg=E5rd?= <mattiase@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 (---)

>> It may have made more sense before the switch of cycle-detection algorit=
hm
>> from Floyd to Brent. This can be fixed by hand-coding the list iteration
>> and explicitly remembering the index of the tortoise, but would that be
>> correct? What's the spec?
>
> I don't think I've ever considered #x to be meaningful outside of
> print-circle, but I guess if we wanted to have some semantics here, I
> think I would have expected the index of the tortoise?  But...

Agreed (and agreed with Andreas as well).
The main goal is to avoid inf-looping and the #NNN chosen is
somewhat arbitrary.

I don't think it's worth it to try and make those #NNN more precise.
If the arbitrariness of the specific #NNN chosen is a problem, we could
replace it with a fixed `#=A1cycle!` or something like that (or if we
want it to be more user-readable we could print something like
#cycle:<OBJ> where OBJ is the first N layers of the rest of the cycle,
like (rho 0 2) =3D> (1 2 1 2 . #cycle:(1 2 1 ...))

I'm personally more bothered by the fact that those #NNN use exactly the
same syntax as used with `print-circle` yet they don't have the
same semantics.


        Stefan





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

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


Received: (at 55395) by debbugs.gnu.org; 13 May 2022 16:08:40 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri May 13 12:08:40 2022
Received: from localhost ([127.0.0.1]:44842 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1npXqJ-0006eq-Qh
	for submit <at> debbugs.gnu.org; Fri, 13 May 2022 12:08:40 -0400
Received: from mail-out.m-online.net ([212.18.0.9]:57703)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <whitebox@HIDDEN>) id 1npXqH-0006eg-2S
 for 55395 <at> debbugs.gnu.org; Fri, 13 May 2022 12:08:38 -0400
Received: from frontend01.mail.m-online.net (unknown [192.168.8.182])
 by mail-out.m-online.net (Postfix) with ESMTP id 4L0D8g4VJRz1qybr;
 Fri, 13 May 2022 18:08:35 +0200 (CEST)
Received: from localhost (dynscan1.mnet-online.de [192.168.6.70])
 by mail.m-online.net (Postfix) with ESMTP id 4L0D8g39Hjz1qqkB;
 Fri, 13 May 2022 18:08:35 +0200 (CEST)
X-Virus-Scanned: amavisd-new at mnet-online.de
Received: from mail.mnet-online.de ([192.168.8.182])
 by localhost (dynscan1.mail.m-online.net [192.168.6.70]) (amavisd-new,
 port 10024)
 with ESMTP id Vfgoa4-DvHHn; Fri, 13 May 2022 18:08:34 +0200 (CEST)
X-Auth-Info: /YfvqwbtfDzbo2lkZopqlppNxSz06UWEnkMseA7Y3x9+3UmifpaEawjFSInJYjA5
Received: from igel.home (ppp-46-244-176-172.dynamic.mnet-online.de
 [46.244.176.172])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (No client certificate requested)
 by mail.mnet-online.de (Postfix) with ESMTPSA;
 Fri, 13 May 2022 18:08:34 +0200 (CEST)
Received: by igel.home (Postfix, from userid 1000)
 id EC87E2C39F5; Fri, 13 May 2022 18:08:33 +0200 (CEST)
From: Andreas Schwab <schwab@HIDDEN>
To: Mattias =?utf-8?Q?Engdeg=C3=A5rd?= <mattiase@HIDDEN>
Subject: Re: bug#55395: What does (1 2 3 . #2) mean?
References: <4B70C9BE-B784-4B74-A081-7A8B3F8D5136@HIDDEN>
X-Yow: NANCY!!  Why is everything RED?!
Date: Fri, 13 May 2022 18:08:33 +0200
In-Reply-To: <4B70C9BE-B784-4B74-A081-7A8B3F8D5136@HIDDEN> ("Mattias
 =?utf-8?Q?Engdeg=C3=A5rd=22's?= message of "Fri, 13 May 2022 13:32:34
 +0200")
Message-ID: <87czghl8ji.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.1 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Spam-Score: -0.5 (/)
X-Debbugs-Envelope-To: 55395
Cc: 55395 <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.5 (-)

On Mai 13 2022, Mattias Engdegård wrote:

> Let's define (rho LEAD LOOP) as the iota list that has a loop LOOP long after LEAD initial elements:
>
> (defun rho (lead loop)
>   (let ((l (number-sequence 1 (+ lead loop))))
>     (setcdr (nthcdr (+ lead loop -1) l) (nthcdr lead l))
>     l))
>
> Then we have:
>
> (rho 0 1) => (1 . #0)
> (rho 0 2) => (1 2 1 2 . #2)
> (rho 0 3) => (1 2 3 1 2 . #2)
> (rho 0 4) => (1 2 3 4 1 2 3 4 1 2 . #5)
> (rho 0 5) => (1 2 3 4 5 1 2 3 4 5 1 . #5)
> (rho 1 4) => (1 2 3 4 5 2 3 4 5 2 . #5)
> (rho 4 1) => (1 2 3 4 5 5 5 . #3)
>
> and so on. The pattern is not obvious to me.
>
> It may have made more sense before the switch of cycle-detection algorithm from Floyd to Brent. This can be fixed by hand-coding the list iteration and explicitly remembering the index of the tortoise, but would that be correct? What's the spec?

I don't think there is a defined meaning behind the number, it's more an
implementation detail.  If you want to have precise cycle detection you
need to enable print-circle.

-- 
Andreas Schwab, schwab@HIDDEN
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510  2552 DF73 E780 A9DA AEC1
"And now for something completely different."




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

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


Received: (at 55395) by debbugs.gnu.org; 13 May 2022 15:22:26 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri May 13 11:22:26 2022
Received: from localhost ([127.0.0.1]:44609 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1npX7a-0002dl-7n
	for submit <at> debbugs.gnu.org; Fri, 13 May 2022 11:22:26 -0400
Received: from quimby.gnus.org ([95.216.78.240]:38692)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <larsi@HIDDEN>) id 1npX7Z-0002dV-75
 for 55395 <at> debbugs.gnu.org; Fri, 13 May 2022 11:22:25 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org;
 s=20200322; h=Content-Transfer-Encoding:Content-Type:MIME-Version:Message-ID
 :In-Reply-To:Date:References: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=wh7aUAW5EiIGtGnrLiJyBR4B71+5aJ3/ARis/ADol5M=; b=b07IHX4IF56vZIAx0cExWM2wB/
 59A6iTSQ6vSg085trSEH+QKsuuDk1Pv4IU6M8ngf/ThjPoAZmdvyXdKxGJyAmLXZ8p/5gPJ69kPbM
 PYbgy5an9H+0lW2w8TCdHJzpny5fWffl6qq4VhJL3CCesRLi0S/hetn86FenqihgZQCI=;
Received: from [84.212.220.105] (helo=xo)
 by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.92) (envelope-from <larsi@HIDDEN>)
 id 1npX7O-00020w-1j; Fri, 13 May 2022 17:22:16 +0200
From: Lars Ingebrigtsen <larsi@HIDDEN>
To: Mattias =?utf-8?Q?Engdeg=C3=A5rd?= <mattiase@HIDDEN>
Subject: Re: bug#55395: What does (1 2 3 . #2) mean?
References: <4B70C9BE-B784-4B74-A081-7A8B3F8D5136@HIDDEN>
X-Now-Playing: Colourbox's _Colourbox (PolyGram)_: "Baby I Love You So"
Date: Fri, 13 May 2022 17:22:13 +0200
In-Reply-To: <4B70C9BE-B784-4B74-A081-7A8B3F8D5136@HIDDEN> ("Mattias
 =?utf-8?Q?Engdeg=C3=A5rd=22's?= message of "Fri, 13 May 2022 13:32:34
 +0200")
Message-ID: <87ilq931ay.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 @@CONTACT_ADDRESS@@ for details.
 
 Content preview:  Mattias Engdegård <mattiase@HIDDEN> writes: > It may have
    made more sense before the switch of cycle-detection algorithm from Floyd
    to Brent. This can be fixed by hand-coding the list iteration and explicitly
    remembering the index of the tortoi [...] 
 
 Content analysis details:   (-2.9 points, 5.0 required)
 
  pts rule name              description
 ---- ---------------------- --------------------------------------------------
 -1.0 ALL_TRUSTED            Passed through trusted hosts only via SMTP
 -1.9 BAYES_00               BODY: Bayes spam probability is 0 to 1%
                             [score: 0.0000]
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 55395
Cc: 55395 <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: -3.3 (---)

Mattias Engdeg=C3=A5rd <mattiase@HIDDEN> writes:

> It may have made more sense before the switch of cycle-detection algorith=
m from Floyd to Brent. This can be fixed by hand-coding the list iteration =
and explicitly remembering the index of the tortoise, but would that be cor=
rect? What's the spec?

I don't think I've ever considered #x to be meaningful outside of
print-circle, but I guess if we wanted to have some semantics here, I
think I would have expected the index of the tortoise?  But...

> If #N means 'Nth object from the top along the path to the current object=
, starting at 0' then we should have
>
> (rho 2 3) =3D> (1 2 3 4 5 . #2)
> (list (rho 2 3)) =3D> ((1 2 3 4 5 . #3))
>
> ie, adding the print depth to the index in the list. Do you agree?

I've added Stefan to the CCs; I'm sure he has an opinion.

--=20
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




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

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


Received: (at submit) by debbugs.gnu.org; 13 May 2022 11:40:52 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri May 13 07:40:52 2022
Received: from localhost ([127.0.0.1]:43037 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1npTfA-00057G-Aa
	for submit <at> debbugs.gnu.org; Fri, 13 May 2022 07:40:52 -0400
Received: from lists.gnu.org ([209.51.188.17]:37244)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <mattiase@HIDDEN>) id 1npTf9-000579-DD
 for submit <at> debbugs.gnu.org; Fri, 13 May 2022 07:40:51 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:46636)
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <mattiase@HIDDEN>) id 1npTf9-00088n-6f
 for bug-gnu-emacs@HIDDEN; Fri, 13 May 2022 07:40:51 -0400
Received: from mail1448c50.megamailservers.eu ([91.136.14.48]:58096
 helo=mail265c50.megamailservers.eu)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <mattiase@HIDDEN>) id 1npTf5-0007sr-Ov
 for bug-gnu-emacs@HIDDEN; Fri, 13 May 2022 07:40:50 -0400
X-Authenticated-User: mattiase@HIDDEN
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=megamailservers.eu;
 s=maildub; t=1652441556;
 bh=HsYx8ZyZPXmKdd+srh2sjIXA6QATRhdgKCR/ONylZsY=;
 h=From:Subject:Date:To:From;
 b=e/DVgB7dR8TxrSeJPNND2HAZFjDsOAkl4YFrWK5fDOJGzME2yrRmiiYkeVmsO3BcG
 ZBsTb8yRdYVluFYEvLW/i6Rc0tFUvrSDsw8loBGB/BgJ4fO5tR16y68V1Ujz4OjPDW
 gTEtFocMn7j24lZdj57XTFdUcQyLeKj76iqxJEJ4=
Feedback-ID: mattiase@HIDDEN
Received: from smtpclient.apple (c188-150-171-71.bredband.tele2.se
 [188.150.171.71]) (authenticated bits=0)
 by mail265c50.megamailservers.eu (8.14.9/8.13.1) with ESMTP id 24DBWYbx028640
 for <bug-gnu-emacs@HIDDEN>; Fri, 13 May 2022 11:32:36 +0000
From: =?utf-8?Q?Mattias_Engdeg=C3=A5rd?= <mattiase@HIDDEN>
Content-Type: text/plain;
	charset=us-ascii
Content-Transfer-Encoding: quoted-printable
Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.120.0.1.13\))
Subject: What does (1 2 3 . #2) mean?
Message-Id: <4B70C9BE-B784-4B74-A081-7A8B3F8D5136@HIDDEN>
Date: Fri, 13 May 2022 13:32:34 +0200
To: bug-gnu-emacs@HIDDEN
X-Mailer: Apple Mail (2.3654.120.0.1.13)
X-CTCH-RefID: str=0001.0A742F17.627E41D4.0038, ss=1, re=0.000, recu=0.000,
 reip=0.000, cl=1, cld=1, fgs=0
X-CTCH-VOD: Unknown
X-CTCH-Spam: Unknown
X-CTCH-Score: 0.000
X-CTCH-Rules: 
X-CTCH-Flags: 0
X-CTCH-ScoreCust: 0.000
X-Origin-Country: SE
Received-SPF: softfail client-ip=91.136.14.48; envelope-from=mattiase@HIDDEN;
 helo=mail265c50.megamailservers.eu
X-Spam_score_int: -11
X-Spam_score: -1.2
X-Spam_bar: -
X-Spam_report: (-1.2 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,
 DKIM_VALID=-0.1, SPF_HELO_NONE=0.001, SPF_SOFTFAIL=0.665,
 T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no 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 (--)

What, exactly, does the #N print notation mean (with print-circle=3Dnil)?

Let's define (rho LEAD LOOP) as the iota list that has a loop LOOP long =
after LEAD initial elements:

(defun rho (lead loop)
  (let ((l (number-sequence 1 (+ lead loop))))
    (setcdr (nthcdr (+ lead loop -1) l) (nthcdr lead l))
    l))

Then we have:

(rho 0 1) =3D> (1 . #0)
(rho 0 2) =3D> (1 2 1 2 . #2)
(rho 0 3) =3D> (1 2 3 1 2 . #2)
(rho 0 4) =3D> (1 2 3 4 1 2 3 4 1 2 . #5)
(rho 0 5) =3D> (1 2 3 4 5 1 2 3 4 5 1 . #5)
(rho 1 4) =3D> (1 2 3 4 5 2 3 4 5 2 . #5)
(rho 4 1) =3D> (1 2 3 4 5 5 5 . #3)

and so on. The pattern is not obvious to me.

It may have made more sense before the switch of cycle-detection =
algorithm from Floyd to Brent. This can be fixed by hand-coding the list =
iteration and explicitly remembering the index of the tortoise, but =
would that be correct? What's the spec?

If #N means 'Nth object from the top along the path to the current =
object, starting at 0' then we should have

(rho 2 3) =3D> (1 2 3 4 5 . #2)
(list (rho 2 3)) =3D> ((1 2 3 4 5 . #3))

ie, adding the print depth to the index in the list. Do you agree?





Acknowledgement sent to Mattias Engdegård <mattiase@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#55395; 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: Wed, 18 May 2022 14:30:02 UTC

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