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

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

Re: deep copy of an alist


From: Edward O'Connor
Subject: Re: deep copy of an alist
Date: Fri, 20 Sep 2002 09:55:33 GMT
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2

>>>>> "Klaus" == Klaus Berndl <Klaus.Berndl@sdm.de> writes:

 Klaus> Is there a function which makes a deep copy of an alist.
 Klaus> AFAIK *copy-alist* makes no copies of the elements of the
 Klaus> alist, i.e. the cars and cdrs of an element are shared...

Doesn't `copy-tree' do what you want?

,----[ C-h f copy-tree RET ]
| copy-tree is an alias for `cl-copy-tree' in `cl-extra'.
| (copy-tree TREE &optional VECP)
| 
| Make a copy of TREE.
| If TREE is a cons cell, this recursively copies both its car and its cdr.
| Contrast to copy-sequence, which copies only along the cdrs.  With second
| argument VECP, this copies vectors as well as conses.
`----


Ted

-- 
Edward O'Connor
ted@oconnor.cx


reply via email to

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