[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Predicate for true lists

From: Basil L. Contovounesios
Subject: Re: Predicate for true lists
Date: Mon, 09 Jul 2018 01:38:53 +0300
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

Drew Adams <address@hidden> writes:

> 2. You say this in the doc string of `proper-list-length':
>    A proper list is neither circular nor dotted (i.e., its
>    last cdr is nil).
> And your entry in the manual for that function:
>   In addition to satisfying @code{listp}, a proper list is
>   neither circular nor dotted.
> Fair enough, but it depends on what is meant by a "circular"
> list.  Does it mean only a list whose last cdr shares list
> structure with some other of its cdr's?  If so then what you
> say holds.  And yes, I guess that's what most of us think of.
> But what of a list that has a finite number of elements,
> so it last cdr is nil, but one or more of whose elements
> is itself a circular list in the above sense?  Is it in
> some sense "circular" because of its circular-list element?

No, because "proper", "circular", and "dotted" all refer to list
structure (CDRs/links), not contents (CARs).

> It should be enough to say that a "true", or "proper"
> list is one that has nil as its last cdr, without
> adding that this means non-"circular".

I think that both "last cdr is nil" and "neither dotted nor circular"
completely qualify a list as being proper, so I would prefer to be
explicit and state both definitions, say, in the docstring.  If nothing
else, it makes the jargon "dotted" and "circular" more discoverable.
Unless my reasoning/understanding is mistaken, that is.


reply via email to

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