Re: copying arrays
- From: "Alan Manuel K. Gloria" <almkglor@xxxxxxxxx>
- Date: 28 Apr 2007 21:57:14 -0700
On Apr 29, 11:16 am, Q <qal...@xxxxxxxxx> wrote:
Hi all,And then there's the problem - what if the array contains instances of
Simple question:
CL-USER 37 > (setf a (make-array 5 :initial-element 7))
#(7 7 7 7 7)
CL-USER 38 > (setf b a)
#(7 7 7 7 7)
CL-USER 39 > (eq a b)
T
CL-USER 40 > (setf (aref a 0) 9)
9
CL-USER 41 > a
#(9 7 7 7 7)
CL-USER 42 > b
#(9 7 7 7 7)
How do I pass copies of the array around, instead of the array
itself? I don't want them to be eq. But, it'd be nice if they were
equal :)
other arrays (or lists, or hashtables, or what not for that matter)?
Do you want to copy the member arrays? Or use the member array
directly? What if we have two arrays that happen to contain each
other?
In my experience it's quite rare to have to have to *copy* a
sequence. If you're manipulating an array, why would you want to
retain the previous version? What is it that you are trying to do?
In general, it is usually very rare that you have to actually copy the
sequence.
.
- Follow-Ups:
- Re: copying arrays
- From: Dan Bensen
- Re: copying arrays
- References:
- copying arrays
- From: Q
- copying arrays
- Prev by Date: Re: Opposite of ~^ FORMAT Directive
- Next by Date: Re: What are the domains that lisp doesn't fit int?
- Previous by thread: Re: copying arrays
- Next by thread: Re: copying arrays
- Index(es):
Relevant Pages
|