emacs-devel
[Top][All Lists]
Advanced

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

Re: "The starting list count" ?????


From: Andreas Schwab
Subject: Re: "The starting list count" ?????
Date: Mon, 03 Jan 2022 19:33:20 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.90 (gnu/linux)

On Jan 03 2022, Robin Tarsiger wrote:

> Alan Mackenzie wrote:
>>     `#N'
>>         When printing circular structures, this construct is used to
>>         represent where the structure loops back onto itself, and `N' is
>>         the starting list count:
>>              (let ((a (list 1)))
>>                (setcdr a a))
>>              => (1 . #0)
>> ..  What does this mean, please?  What does "is the starting list count"
>> mean?  There is only one "list", so what is the "list count"?
>
> I agree that this is a bit too abbreviated, but basically it's the number
> you'd pass to nthcdr along with the immediately enclosing list to get what's
> spliced in as that last cdr.

It gets more complicated if the circle is embedded inside another
object.

ELISP> (list (let ((a (list 1))) (setcdr a a)))
((1 . #1))

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510  2552 DF73 E780 A9DA AEC1
"And now for something completely different."



reply via email to

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