[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#62037: (proper-list-p '#1=(a #1#)) => 2. It should return nil.
From: |
Ruijie Yu |
Subject: |
bug#62037: (proper-list-p '#1=(a #1#)) => 2. It should return nil. |
Date: |
Fri, 31 Mar 2023 12:35:49 +0800 |
User-agent: |
mu4e 1.8.14; emacs 30.0.50 |
>> [...]
>>> 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
- bug#62037: (proper-list-p '#1=(a #1#)) => 2. It should return nil., Alan Mackenzie, 2023/03/07
- bug#62037: (proper-list-p '#1=(a #1#)) => 2. It should return nil., Ruijie Yu, 2023/03/07
- bug#62037: (proper-list-p '#1=(a #1#)) => 2. It should return nil., Philip Kaludercic, 2023/03/18
- bug#62037: (proper-list-p '#1=(a #1#)) => 2. It should return nil., Alan Mackenzie, 2023/03/18
- bug#62037: (proper-list-p '#1=(a #1#)) => 2. It should return nil., Philip Kaludercic, 2023/03/18
- bug#62037: (proper-list-p '#1=(a #1#)) => 2. It should return nil.,
Ruijie Yu <=
- bug#62037: (proper-list-p '#1=(a #1#)) => 2. It should return nil., Philip Kaludercic, 2023/03/31
- bug#62037: (proper-list-p '#1=(a #1#)) => 2. It should return nil., Ruijie Yu, 2023/03/31
- bug#62037: (proper-list-p '#1=(a #1#)) => 2. It should return nil., Eli Zaretskii, 2023/03/31