Added array-broadcast Bradley Lucier 28 Dec 2025 22:44 UTC

I've now added an array-broadcast procedure to the follow-on to SRFI
231:
https://github.com/gambiteer/srfi-231/commit/5ec0ad1ac34378e99f060a68e6fc3c01604f7823

The commit message details some of the decisions that were made after
studying Python's NumPy library and Racket's math/array:
====================
We implement array broadcasting in the style of Python's NumPy or
Racket's math/array.

Arrays in both those systems have only zero lower bounds on indices, and
while Racket has what we call generalized arrays, NumPy does not.
Additionally, Racket allows R-style "permissive" broadcasting.

So we had to make some decisions about how to broadcast arrays with
nonzero lower bounds and generalized arrays.

We decided:

1.  Axes initially added at the left of an array's domain have lower
bounds 0 and upper bounds 1.

2.  Axes with nonzero lower bounds cannot be expanded in broadcasting.

3.  Generalized arrays can be broadcast only to new intervals with the
same volume (so, effectively, can only have length-1 axes added on the
left), returning a generalized array.  I want only 1-1 mappings of
indices for generalized arrays to avoid surprises when those broadcast
arrays are "consumed" by some later operation.

4.  We don't allow R-style "permissive" broadcasting, which requires a
non-affine mapping of indices that is not composable with other array
transformations.

5.  If an array is broadcast to an interval with more elements (of
greater volume), then the resulting array is set to be immutable.

There is not yet automatic broadcasting of array arguments, only the new
procedure array-broadcast.

There is no new documentation.
====================
Any comments about these choices are welcome.