On 3/16/23 5:54 PM, John Cowan wrote:
That pushes matters along a little further: you get the right behavior if the array is specialized.

Well, specialized and the elements are contiguous and in order.

However, it's not clear to me why generalized arrays can't be reshaped, or why non-affine transforms expressed as reshapes require eager copying, rather than a lazy operation similar to mapping.

One can do that in SRFI 231, but one would have to write the transform oneself. I.e., if

> (define A (make-array (make-interval '#(2 4 5)) list))
> (define B (make-array (make-interval '#(40))
                      (let ((A_ (array-getter A)))
                        (lambda (i)
                          (A_ (quotient i 20)
                              (quotient (modulo i 20) 5)
                              (modulo i 5))))))
> (equal? (array->vector A) (array->vector B))
#t

And B is a generalized array out, not a specialized array. (Of course, A itself is generalized.)

This appears similar to SRFI 164/Kawa's array-transform.

Brad

Reply via email to