From: Erik Naggum
Subject: Re: Copying array
Date: 
Message-ID: <3147423459191048@naggum.no>
* "Pascal Saremsky" <······@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

From: Andrew Cooke
Subject: Re: Copying array
Date: 
Message-ID: <7sv5mg$igk$1@nnrp1.deja.com>
In article <················@naggum.no>,
  Erik Naggum <····@naggum.no> wrote:
> * "Pascal Saremsky" <······@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, 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.
From: Andrew Cooke
Subject: Re: Copying array
Date: 
Message-ID: <7sv5mo$igl$1@nnrp1.deja.com>
In article <················@naggum.no>,
  Erik Naggum <····@naggum.no> wrote:
> * "Pascal Saremsky" <······@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, 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.
From: Barry Margolin
Subject: Re: Copying array
Date: 
Message-ID: <9LOI3.359$854.12368@burlma1-snr2>
In article <············@nnrp1.deja.com>,
Andrew Cooke  <······@andrewcooke.free-online.co.uk> wrote:
>In article <················@naggum.no>,
>  Erik Naggum <····@naggum.no> wrote:
>> * "Pascal Saremsky" <······@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, ······@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.
From: Pierre R. Mai
Subject: Re: Copying array
Date: 
Message-ID: <87d7v0xb77.fsf@orion.dent.isdn.cs.tu-berlin.de>
Barry Margolin <······@bbnplanet.com> writes:

> In article <············@nnrp1.deja.com>,
> Andrew Cooke  <······@andrewcooke.free-online.co.uk> wrote:
> >In article <················@naggum.no>,
> >  Erik Naggum <····@naggum.no> wrote:
> >> * "Pascal Saremsky" <······@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 <····@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]
From: Barry Margolin
Subject: Re: Copying array
Date: 
Message-ID: <VS3J3.391$854.13187@burlma1-snr2>
In article <··············@orion.dent.isdn.cs.tu-berlin.de>,
Pierre R. Mai <····@acm.org> wrote:
>Barry Margolin <······@bbnplanet.com> writes:
>
>> In article <············@nnrp1.deja.com>,
>> Andrew Cooke  <······@andrewcooke.free-online.co.uk> wrote:
>> >In article <················@naggum.no>,
>> >  Erik Naggum <····@naggum.no> wrote:
>> >> * "Pascal Saremsky" <······@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....

-- 
Barry Margolin, ······@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.