- array-interval arrayprocedure
Returns the "interval" of a given array. The current interval of a given array is the range of multi-dimensional indices that are valid for that array object. It is not always the case that the interval starts at the default (zero) multi-index. For example:
(import generalized-arrays) (define a (make-array vector-storage-class #(3 3) 0)) (test "Interval of array a" (make-interval #(0 0) #(3 3)) (array-interval a)) (define b (array-slice a #(1 1) #(2 2))) (test "Interval of array b" (make-interval #(1 1) #(2 2)) (array-interval b))
In the above example, the array b is a slice of array a, from #(1 1) to #(2 2), so while b shares the same storage-object as a, the interval of b is smaller than that of a.
array-interval is meant to be used as a low-level mechanism for being able to work with slices over a shared storage-object. In most cases, you'll want to use array-shape to get the semantic interval over the array, rather than array-interval.