Re: various comments Jussi Piitulainen (17 Nov 2001 14:03 UTC)
Re: various comments Radey Shouman (17 Nov 2001 18:27 UTC)
Re: various comments Jussi Piitulainen (18 Nov 2001 14:50 UTC)
Re: various comments Per Bothner (19 Nov 2001 19:52 UTC)
Re: various comments Jussi Piitulainen (20 Nov 2001 08:14 UTC)
Re: various comments Per Bothner (20 Nov 2001 18:35 UTC)
Re: various comments Jussi Piitulainen (20 Nov 2001 19:20 UTC)
Re: various comments Per Bothner (20 Nov 2001 19:33 UTC)
Re: various comments Jussi Piitulainen (20 Nov 2001 20:14 UTC)
Re: various comments Radey Shouman (21 Nov 2001 03:31 UTC)
Re: various comments Radey Shouman (19 Nov 2001 23:26 UTC)
Re: various comments Jussi Piitulainen (20 Nov 2001 08:43 UTC)
Re: various comments Per Bothner (20 Nov 2001 19:20 UTC)
Re: various comments Jussi Piitulainen (20 Nov 2001 20:02 UTC)
Re: various comments Per Bothner (20 Nov 2001 21:08 UTC)
Re: various comments Radey Shouman (21 Nov 2001 03:58 UTC)
Re: various comments Jussi Piitulainen (21 Nov 2001 16:52 UTC)
Re: various comments Radey Shouman (21 Nov 2001 03:47 UTC)
Vectors as arrays Re: various comments Jussi Piitulainen (20 Nov 2001 18:03 UTC)
Re: Vectors as arrays Re: various comments Radey Shouman (21 Nov 2001 04:09 UTC)

Re: various comments Jussi Piitulainen 20 Nov 2001 20:14 UTC

Per Bothner writes:

> Jussi Piitulainen wrote:
>
>> (define arr1 (share-array arr (shape 0 3) (lambda (j) (- 2 j))))
>>
>> Then I get essentially the same array as vec. Its implementation
>> might be more expensive, though, while vec remains oblivious to all
>> that is going on.
>
> The result arr1 should *not* point to arr, but should just re-use
> the same data vector vec.

Precisely.

> In this case share-array may do a little more work, but the result
> should *not* be any more expensive to use - in fact it should be
> exactly the same, using the same data-vector.

Arrays that share the same backing vector are the same. Just the index
maps are different, and shapes.

But arr1 is a zero-based one-dimensional array whose elements are
exactly the elements of its backing vector in their native order, so
it could as well be just the backing vector, now that we assume
vectors are arrays.

> However, (eq? arr arr1) must be #f.

Oh, but even (equal? arr arr1) must be #f. The question is, will we
accept (eq? vec arr1) as #f when that could be #t. Here vec was R5RS
vector, arr shared it in reverse, and arr1 shared arr in reverse.

The cost of making (eq? vec arr1) #t might not be too high at all.
--
Jussi