[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: various comments



Jussi Piitulainen <jpiitula@xxxxxxxxxxxxxxxx> writes:

> If I do so:
> 
> (define vec (vector "a" "b" "c"))
> (define arr (share-array vec (shape 0 3) (lambda (j) (- 2 j))))
> 
> Then vec is a simple R5RS vector, but it is also the backing vector of
> arr, and thus sharable and indeed shared, though it does not know it,
> so to speak.
> 
> Now if I do further:
> 
> (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.

In fact SCM will define arr1 as the original vector vec in this case.