[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#26629: 25.1.50; Feature-request: Structure-preserving copying of seq
From: |
Lars Ingebrigtsen |
Subject: |
bug#26629: 25.1.50; Feature-request: Structure-preserving copying of sequences |
Date: |
Fri, 13 May 2022 18:18:09 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) |
Tobias Zawada <i@tn-home.de> writes:
> The function copy-tree copies recursively but not structure preserving.
> If two cars or cdrs link to the same sub-list in the original data
> they point to two separate sub-lists in the copy.
[...]
> About the code: Traversing of the original graph and construction of the new
> graph are
> stack-based as it is standard. There is an additional hash-map that maps
> the already traversed old nodes to the newly created ones. If some old
> node is already in the hash-map we do not create a new one in the copied
> graph but use the mapped one from the hash map.
(I'm going through old bug reports that unfortunately weren't resolved
at the time.)
I haven't looked closely at the code, but this is functionality that I
vaguely remember having been requested before, and I don't think Emacs
has it yet? (But I may be wrong about that.)
I've added Stefan to the CCs; perhaps he has some comments.
This change is large enough to require a copyright assignment of the
code to the FSF -- if we decide to add the code, would you be willing to
sign such paperwork?
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
- bug#26629: 25.1.50; Feature-request: Structure-preserving copying of sequences,
Lars Ingebrigtsen <=