bug-gnu-emacs
[Top][All Lists]
Advanced

[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: Philip Kaludercic
Subject: bug#62037: (proper-list-p '#1=(a #1#)) => 2. It should return nil.
Date: Fri, 31 Mar 2023 07:25:12 +0000

Ruijie Yu <ruijie@netyu.xyz> writes:

>>> [...]
>>>> 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.

It might be lacking, but I don't think the explanation is ambiguous.
"its last cdr is nil" might not be awfully formal, but it does describe
the problem.

> 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.

-- 
Philip Kaludercic





reply via email to

[Prev in Thread] Current Thread [Next in Thread]