[Top][All Lists]

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

Re: using setq to create lists based on other lists...

From: Jean-Christophe Helary
Subject: Re: using setq to create lists based on other lists...
Date: Mon, 3 Dec 2018 00:41:01 +0900

> On Dec 3, 2018, at 0:07, Stefan Monnier <> wrote:
> Here's another take on it:
>> If you do
>> (setcar list0 0)
> Why?  Just don't use setcar/setcdr!

Lovely :)

When I check "Modifying Existing List Structure" the only things I find of any 
use in my case are setcar/setcdr.

>> There are probably better ways to create lists based on other lists without
>> "linking" the two, so I'd like some information about that.
> The better way is to not modify the lists, so you're not affected by
> whether they're linked or not.

I would certainly have considered that if I had known that setq was linking the 
lists :)

And I'm sure the code I wrote is laughable, because there are probably 
thousands of more idiomatic ways to write what I want to achieve, but if there 
had been just a footnote about setq linking lists, I certainly would not have 
spent the day on that :)

Jean-Christophe Helary
----------------------------------------------- @brandelune

reply via email to

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