Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Copying array

0 views
Skip to first unread message

Erik Naggum

unread,
Sep 27, 1999, 3:00:00 AM9/27/99
to
* "Pascal Saremsky" <pas...@docdes.com>
| What's the fastest way to copy a more than one-dimensional array in
| Common Lisp?

a tight loop over all the elements using ROW-MAJOR-AREF.

#:Erik

Andrew Cooke

unread,
Sep 30, 1999, 3:00:00 AM9/30/99
to
In article <31474234...@naggum.no>,

Can't see the original request, but just wanted to add that there is an
example in Cltl which shows how and also some interesting comments in
one of the "parenthetically speaking" columns about why there is no one
"copy" in Lisp.

If you don't know what Cltl is, look for "common lisp the language"
under documentation at http://www.elwoodcorp.com/alu/table/contents.htm
(the section I'm thinking of sticks in the mind because the author
becomes quite gushing about the code).

The P.S. columns are at http://world.std.com/~pitman/PS/About-PS.html

Andrew
http://www.andrewcooke.free-online.co.uk/index.html


Sent via Deja.com http://www.deja.com/
Before you buy.

Andrew Cooke

unread,
Sep 30, 1999, 3:00:00 AM9/30/99
to

Barry Margolin

unread,
Sep 30, 1999, 3:00:00 AM9/30/99
to
In article <7sv5mo$igl$1...@nnrp1.deja.com>,

Andrew Cooke <and...@andrewcooke.free-online.co.uk> wrote:
>In article <31474234...@naggum.no>,
> Erik Naggum <er...@naggum.no> wrote:
>> * "Pascal Saremsky" <pas...@docdes.com>
>> | What's the fastest way to copy a more than one-dimensional array in
>> | Common Lisp?
>>
>> a tight loop over all the elements using ROW-MAJOR-AREF.
>
>Can't see the original request

Yes you can. Erik quoted it in its entirety.

Actually, since the original message specifically says that the array is
one-dimensional, you can use AREF rather than ROW-MAJOR-AREF.
ROW-MAJOR-AREF is useful to treat a multi-dimensional array as if it's
one-dimensional.

COPY-SEQ can also be useful for this. However, it won't preserve
attributes like adjustability, fill pointer, etc.

--
Barry Margolin, bar...@bbnplanet.com
GTE Internetworking, Powered by BBN, Burlington, MA
*** DON'T SEND TECHNICAL QUESTIONS DIRECTLY TO ME, post them to newsgroups.
Please DON'T copy followups to me -- I'll assume it wasn't posted to the group.

Pierre R. Mai

unread,
Oct 1, 1999, 3:00:00 AM10/1/99
to
Barry Margolin <bar...@bbnplanet.com> writes:

> In article <7sv5mo$igl$1...@nnrp1.deja.com>,
> Andrew Cooke <and...@andrewcooke.free-online.co.uk> wrote:
> >In article <31474234...@naggum.no>,
> > Erik Naggum <er...@naggum.no> wrote:
> >> * "Pascal Saremsky" <pas...@docdes.com>
> >> | What's the fastest way to copy a more than one-dimensional array in
> >> | Common Lisp?
> >>
> >> a tight loop over all the elements using ROW-MAJOR-AREF.
> >
> >Can't see the original request
>
> Yes you can. Erik quoted it in its entirety.
>
> Actually, since the original message specifically says that the array is
> one-dimensional, you can use AREF rather than ROW-MAJOR-AREF.
> ROW-MAJOR-AREF is useful to treat a multi-dimensional array as if it's
> one-dimensional.

Since the original message has been quoted in entirety by everyone, it
can be seen that the original message specifically says that the array
is _more_ than one-dimensional, which is why Erik answered the way he
did. ;)

Regs, Pierre.

--
Pierre Mai <pm...@acm.org> PGP and GPG keys at your nearest Keyserver
"One smaller motivation which, in part, stems from altruism is Microsoft-
bashing." [Microsoft memo, see http://www.opensource.org/halloween1.html]

Barry Margolin

unread,
Oct 1, 1999, 3:00:00 AM10/1/99
to
In article <87d7v0x...@orion.dent.isdn.cs.tu-berlin.de>,

Pierre R. Mai <pm...@acm.org> wrote:
>Barry Margolin <bar...@bbnplanet.com> writes:
>
>> In article <7sv5mo$igl$1...@nnrp1.deja.com>,
>> Andrew Cooke <and...@andrewcooke.free-online.co.uk> wrote:
>> >In article <31474234...@naggum.no>,
>> > Erik Naggum <er...@naggum.no> wrote:
>> >> * "Pascal Saremsky" <pas...@docdes.com>
>> >> | What's the fastest way to copy a more than one-dimensional array in
>> >> | Common Lisp?
>> >>
>> >> a tight loop over all the elements using ROW-MAJOR-AREF.
>> >
>> >Can't see the original request
>>
>> Yes you can. Erik quoted it in its entirety.
>>
>> Actually, since the original message specifically says that the array is
>> one-dimensional, you can use AREF rather than ROW-MAJOR-AREF.
>> ROW-MAJOR-AREF is useful to treat a multi-dimensional array as if it's
>> one-dimensional.
>
>Since the original message has been quoted in entirety by everyone, it
>can be seen that the original message specifically says that the array
>is _more_ than one-dimensional, which is why Erik answered the way he
>did. ;)

I hate when I get pedantic and it turns out I misread....

0 new messages