GNU bug report logs - #62037
(proper-list-p '#1=(a #1#)) => 2. It should return nil.

Previous Next

Package: emacs;

Reported by: Alan Mackenzie <acm <at> muc.de>

Date: Tue, 7 Mar 2023 17:31:01 UTC

Severity: normal

Full log


Message #20 received at 62037 <at> debbugs.gnu.org (full text, mbox):

From: Ruijie Yu <ruijie <at> netyu.xyz>
To: Philip Kaludercic <philipk <at> posteo.net>
Cc: Alan Mackenzie <acm <at> muc.de>, 62037 <at> debbugs.gnu.org
Subject: Re: bug#62037: (proper-list-p '#1=(a #1#)) => 2.  It should return
 nil.
Date: Fri, 31 Mar 2023 12:35:49 +0800
>> [...]
>>> 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’s CDR could point to 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=(a . #1#) is clearly circular.  proper-list-p should return
>> nil for it.
>
> But (proper-list-p '#1=(a . #1#)) does return nil? [...]
>
> because #1=(a #1#)) is not a circular list, the cadr only has a
> reference back to a the beginning of the list, but #1=(a . #1#)) is
> cyclical because as you say a cdr points back to a previous cons cell:
> [...]
>
>> 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.
> [...]

So, it all boils down to the fact that the current documentation is
lacking and/or ambiguous, in terms of "the purpose of `proper-list-p'",
as well as the two definitions of the adjective "circular", which are
not interchangeable in different contexts.

If we all agree that only some pieces of documentation need updating,
then I will try to come up with a patch(set) in the upcoming few days --
or someone else can, should one volunteers to do so.  FTR, I am still
waiting for a counter signature from FSF.

-- 
Best,


RY




This bug report was last modified 138 days ago.

Previous Next


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