From ... From: Erik Naggum Subject: Re: newbie problem with updating lists? Date: 2000/11/20 Message-ID: <3183712229165050@naggum.net>#1/1 X-Deja-AN: 695742074 References: <8vb4ic$j0ke$1@spnode25.nerdc.ufl.edu> mail-copies-to: never Content-Type: text/plain; charset=us-ascii X-Complaints-To: newsmaster@eunet.no X-Trace: oslo-nntp.eunet.no 974726222 9231 195.0.192.66 (20 Nov 2000 13:17:02 GMT) Organization: Naggum Software; vox: +47 800 35477; gsm: +47 93 256 360; fax: +47 93 270 868; http://naggum.no; http://naggum.net User-Agent: Gnus/5.0803 (Gnus v5.8.3) Emacs/20.7 Mime-Version: 1.0 NNTP-Posting-Date: 20 Nov 2000 13:17:02 GMT Newsgroups: comp.lang.lisp * "Jeremy Rowlings" | Everytime after updating list1,2,3 I also update biglist to have a | history of changes. my problem is biglist also updates itself, in | other words in contains the last values of list1,2,3 repeated many | times instead of having the history of values. How can I prevent | biglist from changing itself? How do you "update" list1..3? This kind of thing would happen if you retain the first cons of each of those lists and destructively modify its car or cdr. It is not biglist which modifies itself, but the _identity_ of the list elements that reflects the current value, since you have not copied the list structure or contents, only the list identity, which is the first cons. If you really want to keep a history of changes when you make destructive modifications to the list, use copy-list or copy-tree, but then that probably means you will waste all the effort that went into prematurely optimizing your code with destructive list operations. #:Erik -- ALGORITHM: a procedure for solving a mathematical problem in a finite number of steps that frequently involves repetition of an operation. ALGOREISM: a procedure for solving an electoral problem in a finite number of steps that frequently involves repetition of an operation.