No default value for array-reduce on empty arrays
Bradley Lucier 13 Jun 2022 17:13 UTC
I'd like to point out that there is no default value for array-reduce on
empty arrays for any operator. I couldn't figure out a reasonable way
to provide one, short of something like an alist with
+ -> 0
fx+ -> 0
fl+ -> 0.0
* -> 1
fx* -> 1
fl* -> 1.0
etc. (Although I can't imagine right now what other entries might be in
the table.) This affects array-inner-product, too.
array-fold[l|r] returns what I call the "identity" argument for empty
arrays. But you can't pass such an argument to reduce.
Brad