Some thoughts... David Rush (21 Nov 2001 19:26 UTC)
Bad things Re: Some thoughts... Jussi Piitulainen (21 Nov 2001 20:25 UTC)
Re: Bad things Re: Some thoughts... David Rush (22 Nov 2001 16:10 UTC)
Access time of elements Re: Bad things [] Jussi Piitulainen (27 Nov 2001 10:59 UTC)
Re: Access time of elements Re: Bad things [] Per Bothner (27 Nov 2001 17:10 UTC)
Re: Access time of elements Re: Bad things [] David Rush (27 Nov 2001 17:25 UTC)
Re: Access time of elements Re: Bad things [] Per Bothner (27 Nov 2001 17:55 UTC)
Re: Access time of elements Re: Bad things [] David Rush (27 Nov 2001 21:19 UTC)
Re: Access time of elements Re: Bad things [] Jussi Piitulainen (28 Nov 2001 15:40 UTC)
Re: Access time of elements Re: Bad things [] Jussi Piitulainen (28 Nov 2001 16:20 UTC)
Re: Access time of elements Re: Bad things [] Noel Welsh (28 Nov 2001 10:55 UTC)
Re: Access time of elements Re: Bad things [] Jussi Piitulainen (28 Nov 2001 17:21 UTC)

Re: Access time of elements Re: Bad things [] Jussi Piitulainen 28 Nov 2001 15:40 UTC

David Rush writes:

> Per Bothner writes:
>> The main problem with (2) is that it adds a new concept - an "index
>> object" data-type.
>
> Yep, but it actually adds value, I think. Sooner or later people are
> going to want slicing; having the index-object present helps pave
> the way for that.

It's easy to pick all kinds of parts of an array even with the current
mechanisms. Take the third slice from front of a 4*4*4 cube as a 4*4
matrix (assume zero based, depth first):

  (share-array cube (shape 0 4 0 4) (lambda (r k) (values 2 r k))).

Equally easy to pick second slice from top, or rightmost slice.

And I wrote a very general (every-nth arr d n) that shares every nth
slice of arr along dimension d. For the identity matrix i_4,

(every-nth i_4 0 3)   (every-nth i_4 1 3)
==>                   ==>
1 0 0 0               1 0
0 0 0 1               0 0
                      0 0
                      0 1

It's a dozen lines, including a non-destructive auxiliary for changing
the dth element of a list (the arguments to the affine map).
--
Jussi