This page is part of the web mail archives of SRFI 25 from before July 7th, 2015. The new archives for SRFI 25 are here. Eventually, the entire history will be moved there, including any new messages.
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 samedata vector vec. 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. The implementation can also optionally share shapes and transformation maps. However, (eq? arr arr1) must be #f. If you create a chain of shared arrays, one from the previous,they all point back to the original vector, and all the intermediaries can be
garbage collected if not otherwise referenced. This is essential. --Per Bothner