array-fold-{left|right} and array-reverse Bradley Lucier 29 Sep 2016 18:15 UTC

Sudarshan:

I've been thinking about your comments about interval-reduce and
array-reduce.

I got rid of interval-reduce.  It didn't make much sense.

I've also decided to replace array-reduce with array-fold-left and
array-fold-right.

But to do that properly, I'll want to add a routine

(array-reverse array flip?)

where flip? is a vector of booleans of the same dimension as array.  (Or
should it be a list?  Opinions?)

This returns an array (immutable, mutable, or specialized, depending on
the input array) with the same domain as the input array.  The getter of
the result array would be computed as follows: For every coordinate $m$
of flip? that is true, the mapping
$$
i_m\to u_m+l_m-1-i_m
$$
would be applied to the $m$th index of a multi-index.  ($l_m$ and $u_m$
are the lower and upper bounds in the $m$th coordinate direction.) Then,
the getter of the original array would be applied to the transformed
multi-index.

This transform is like reversing the order of one or both of the rows
and columns of a spreadsheet, and is another example of "sharing" a
Bawden-style array by applying an affine transform to the multi-index.

It will take me a few days to finish this.

Brad