Sam Steingold wrote:
> I thought I was modifying a local copy of the global data, but actuallySo generally speaking, one has to explicitly copy things that look like an address such as one can use `setf' to modify its content.
> the global data was changed as well.
a-list is just a cons cell, which is a reference or a pointer or an
address - call it as you like, but it is not an immediate object in the
sense that you have to explicitly copy it when you want a copy to be
Thanks for your suggestion. I could not find a copy of Graham's book for the time being. And I don't think there is any downloadable electronic copy.
> I don't want to modify the global data, since I have to use the global
> data multiple times and change the changes of each action. Can anybody
you should copy the global list each time, like this:
(let ((lst (copy-list a-list)))
(setf lst (change2 lst 10)))
You will probably benefit from reading "ANSI CL" by Paul Graham.
You might also want to subscribe to the comp.lang.lisp newsgoup.
Thanks for your prompt reply.
-- Give all orders verbally. Never write anything down that might go into a "Pearl Harbor File".