Anything missing? Discussion of array-foldl and array-foldr Bradley Lucier 18 Jun 2022 16:47 UTC

It has been my intention to understand and address every suggestion that
people have made for this SRFI.

In response, I've added new routines, added empty and zero-dimensional
arrays, added examples to the SRFI, and, sometimes, decided not to add a
specific routine or example to the SRFI, especially if it can easily be
programmed using existing routines.

So, have we missed something important?

Also, instead of the SRFI 1/Racket/... left fold array-fold of SRFI 179,
there is now a Haskell/OCaml/... array-foldl.  I was thinking
specifically of matrix multiplication of matrices of different
dimensions, which would have different left and right identities.  So
array-foldl would take the left identity as the argument (putting the
accumulated result as the left argument of the operator), and
array-foldr would take the right identity as the argument (putting the
accumulated result as the right argument of the operator).

This goes against what is implied by the very suggestive notation for
the (left) fold of SRFI 1, (fold kons knil l), but it's trivial to
reverse arrays, so I decided to define two routines based on whether
they accumulate on the left, and take a left identity as an argument, or
whether they accumulate on the right, and take a right identity as an
argument.

There's some discussion online about the benefits of each approach,
which I don't understand completely, but I didn't want to slide this
change by unnoticed.

Brad