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

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

bug#64960: Documentation for copy-sequence


From: uzibalqa
Subject: bug#64960: Documentation for copy-sequence
Date: Mon, 31 Jul 2023 06:19:46 +0000

------- Original Message -------
On Monday, July 31st, 2023 at 5:24 PM, Michael Heerdegen 
<michael_heerdegen@web.de> wrote:


> uzibalqa via "Bug reports for GNU Emacs, the Swiss army knife of text
> editors" bug-gnu-emacs@gnu.org writes:
> 
> > > > When I modify the copy, the original remains intact.
> > > 
> > > No, if you modify an element of the copy, the corresponding element of
> > > the original is also changed. That's what "shared" means.
> > 
> > Except for strings
> 
> 
> It is irrelevant what happens when you modify elements of a copied
> string because it is impossible. The statement is simply not applicable
> to strings. That's why the docstring only speaks of "list, vector or
> record".

> Note that substituting a character in a string is not the same as
> modifying the character. You are substituting a sequence element with
> another one and not modifying an element in that case.

That I understand.  I am substituting, but still one gets a different string
nevertheless.
 
> The same is true for the list (1 2 3) for example. Exactly the same
> situation as for a string: You can replace the number 2 in a copy with
> another one but you can't modify the number 2 in the list. Numbers and
> characters are not mutable.

This is the difficult part.  You have a copy of a list and you can swap
elements but not make new ones.  So what you share is the address, where
element 2 say uses the address of element 3.

All this copy-sequence is then quite restrictive in its capabilities.
It does not allow much changes.   
 
> Michael.
>





reply via email to

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