How to make a copy of a list



when copy-list or copy-tree are not deep enough?
I have a big list and I need a function that returns one of its
branches depending on condition.
Later on, in another function I use that branch and modify it
(appending other lists to it).
Now, even though I return that branch using copy-tree, still when I
modify that branch, it modifies the original tree.
Is it because copy-tree only copies conses but not the atoms
themselves?
How can I do a deep copy of the list so it creates a completely new
instance of that branch?

Thank you,
Andrew
.



Relevant Pages

  • Re: How to make a copy of a list
    ... in another function I use that branch and modify it ... (appending other lists to it). ... Now, even though I return that branch using copy-tree, still when I ... sequencep sais whether it is a sequence. ...
    (comp.lang.lisp)
  • Re: Is this a bug in Python or something I do not understand.
    ... L1 is a list of three different lists, ... L2 is a list of three references to the same list (the '*' operator ... doesn't do a deep copy). ... So when you modify any of the referenced ...
    (comp.lang.python)
  • Re: Real Post - The Compositional Center of Gravity -
    ... Perhaps I should have gone ten deep - instead of only five deep - for ... the 20th century lists, to widen the scope. ... To all - Mahler anchors the Austrian squad for 1901-1950 and he's ... turmoil and some of their aesthetic influence has waned. ...
    (rec.music.classical.recordings)
  • Re: Copy List
    ... What will a "deep copy" of a list give you that using the slice ... With a shallow copy, you end up with a new list object, but the items ... appending 100 to the object at index 2 can be seen in both lists. ...
    (comp.lang.python)
  • Re: The "never use string commands with lists" mantra - Why?
    ... Sometimes that [expr] is buried several levels ... deep, etc. ... > but it is also a security practice. ... You should listify things you don't know are lists, ...
    (comp.lang.tcl)