[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Appending lists
From: |
tomas |
Subject: |
Re: Appending lists |
Date: |
Wed, 16 Jun 2021 20:49:15 +0200 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
On Wed, Jun 16, 2021 at 06:54:18PM +0200, Emanuel Berg via Users list for the
GNU Emacs text editor wrote:
> Jean Louis wrote:
>
> > You said vairable did not change, maybe it did not change
> > somewhere underground
>
> This is how I understand it:
>
> The variable has a reference to the first cons cell of the
> list. The cons cell has a car and a cdr as always, where the
> cdr is a reference to the second element of the list, which is
> also a cons cell, and so on.
Yup :)
> The car of the first element's cons cell remains the same but
> the cdr has changed as a side-effect of `nreverse' (or
> `nconc').
This is a side branch, which isn't really relevant. It's the
content of the variable (the ref to the first car) which we
are focussed on now.
The (content of the) car itself could change, e.g. via `setcar'.
> So when the variable seemingly holding the list, but actually
> only holding a reference to the first cons cell, when this
> variable is used one will have a different list as a result
> even tho the reference is the same, unchanged.
Spot on.
> tomas, is this correct? Maybe I won't have to draw the diagram
> after all... :)
Maybe. Drawing is still always nice and enlightening [1] (my
recommendation was somewhat directed at Jean Louis, but still :)
Cheers
[1] It is to me, at least.
- t
signature.asc
Description: Digital signature
- Re: Appending lists, (continued)
- Re: Appending lists, tomas, 2021/06/17
- Re: Appending lists, Emanuel Berg, 2021/06/16
- Re: Appending lists, Emanuel Berg, 2021/06/16
- [OT] Underground (was: Appending lists), tomas, 2021/06/16
- Re: [OT] Underground (was: Appending lists), Emanuel Berg, 2021/06/18
- Re: Appending lists, Emanuel Berg, 2021/06/16
- Re: Appending lists,
tomas <=
- Re: Appending lists, Jean Louis, 2021/06/16
- Re: Appending lists, Stefan Monnier, 2021/06/16
- Re: Appending lists, Jean Louis, 2021/06/16
- Re: Appending lists, Emanuel Berg, 2021/06/16
- Re: Appending lists, Emanuel Berg, 2021/06/16
- Re: Appending lists, tomas, 2021/06/17
- Re: Appending lists, Emanuel Berg, 2021/06/16
- Re: Appending lists, Emanuel Berg, 2021/06/16
- Re: Appending lists, Stefan Monnier, 2021/06/16
- Re: Appending lists, tomas, 2021/06/16