From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Philip Kaludercic Newsgroups: gmane.emacs.bugs Subject: bug#62037: (proper-list-p '#1=(a #1#)) => 2. It should return nil. Date: Sat, 18 Mar 2023 13:48:40 +0000 Message-ID: <87y1nuw4p3.fsf@posteo.net> References: <873562jylh.fsf@posteo.net> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="4465"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Ruijie Yu , 62037@debbugs.gnu.org To: Alan Mackenzie Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Mar 18 14:49:19 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pdWvv-0000zl-HM for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 18 Mar 2023 14:49:19 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pdWvg-0001Oy-DC; Sat, 18 Mar 2023 09:49:04 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pdWve-0001Op-6A for bug-gnu-emacs@gnu.org; Sat, 18 Mar 2023 09:49:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pdWvd-00061k-UL for bug-gnu-emacs@gnu.org; Sat, 18 Mar 2023 09:49:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pdWvd-0003xm-L2 for bug-gnu-emacs@gnu.org; Sat, 18 Mar 2023 09:49:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Philip Kaludercic Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 18 Mar 2023 13:49:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 62037 X-GNU-PR-Package: emacs Original-Received: via spool by 62037-submit@debbugs.gnu.org id=B62037.167914730715190 (code B ref 62037); Sat, 18 Mar 2023 13:49:01 +0000 Original-Received: (at 62037) by debbugs.gnu.org; 18 Mar 2023 13:48:27 +0000 Original-Received: from localhost ([127.0.0.1]:46685 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pdWv4-0003wu-Uz for submit@debbugs.gnu.org; Sat, 18 Mar 2023 09:48:27 -0400 Original-Received: from mout01.posteo.de ([185.67.36.65]:57621) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pdWv2-0003wE-FE for 62037@debbugs.gnu.org; Sat, 18 Mar 2023 09:48:25 -0400 Original-Received: from submission (posteo.de [185.67.36.169]) by mout01.posteo.de (Postfix) with ESMTPS id 7974B24003E for <62037@debbugs.gnu.org>; Sat, 18 Mar 2023 14:48:17 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1679147298; bh=hcXccycBGQ6KO/MEfafwQrEEsbpXhB4czDDr/oghKn4=; h=From:To:Cc:Subject:Date:From; b=HdkTK835vU4FDUyONSzTHlYNy0diahlW3ijMTj/ETh1hUtS5bLNnv8sC0ktqJFSth Lbvg8Bgs0D4YrCFrTrX+5xf72GDW8qjc3cIx7Msg+Vap+/Loa9+bUKvz3+z94TdsmG iv1/k3457NWmv1chm59c/x13ykswbI3ypiJj1tB5e+248XWsDYt41aiyYkP10sVy5E e3U8+S561N9eEPx/TP3BpClrx9qIkRlZWPQOtqKiYBTs7G7iScjOJyKt3rXEGsEz/W SKb0I5qPn/KAgV3rHp4ZYgCFj6vPSrh2hBTTj/izFRupRQJwqpA7LcRTx+5Z/kjkYE BirD9p1Fiw+Aw== Original-Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4Pf2Q86DSkz9rxF; Sat, 18 Mar 2023 14:48:16 +0100 (CET) In-Reply-To: (Alan Mackenzie's message of "Sat, 18 Mar 2023 08:29:02 +0000") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:258178 Archived-At: Alan Mackenzie writes: > Hello, Philip. > > On Sat, Mar 18, 2023 at 07:41:14 +0000, Philip Kaludercic wrote: >> Ruijie Yu writes: > >> > Notice the distinction between these two snippets: > >> > (let ((lst-1 '#1=3D(a #1#))) >> > (list lst-1 (proper-list-p lst-1))) >> > ;; =3D> ((a #1) 2) > >> > (let ((lst-2 '#1=3D(a . #1#))) >> > (list lst-2 (proper-list-p lst-2))) >> > ;; =3D> ((a . #0) nil) > >> Doesn't this point resolve the issue? > > No, it doesn't. A circular list is defined (Elisp manual page "Lists > and Cons Cells") as one where "some cons cell=E2=80=99s CDR could point t= o one > of the previous cons cells in the list". A proper list (page > "List-related Predicates") is one which is neither dotted nor circular. > > The list #1=3D(a . #1#) is clearly circular. proper-list-p should return > nil for it. But (proper-list-p '#1=3D(a . #1#)) does return nil? And (proper-list-p '#1=3D(a #1#)) does return 2,=20 +---+---+ +---+---+ | a | ----->| | | ------> nil +---+---+ +-|-+---+ ^ | \_________/ because #1=3D(a #1#)) is not a circular list, the cadr only has a reference back to a the beginning of the list, but #1=3D(a . #1#)) is cyclical because as you say a cdr points back to a previous cons cell: +---+---+ | a | | | +---+-|-+ ^ |=20=20 \__/ > The purpose of proper-list-p is surely to find out in advance whether an > algorithm one wishes to run on a list can proceed without taking special > precautions for dottedness or circularity. proper-list-p fails here. > >> Shouldn't the bug report be closed? > > Only once it's been fixed. > >> -- >> Philip Kaludercic