Re: Left folds Bradley Lucier 23 Sep 2022 18:39 UTC

On 9/23/22 1:22 PM, John Cowan wrote:
> What I'd like to do is this:
>
> For all sequences, provide either `fold` and `fold-right` with SRFI 1
> conventions (the accumulation is the rightmost argument) or `foldl` and
> `foldr` with SRFI 43 conventions (accumulator is the leftmost
> argument).  Currently all the vector-like SRFIs use SRFI 43 conventions
> with the names `fold` and `right-fold` as a consequence of being
> textually descended from SRFI 43, so these SRFIs would be changed
> incompatibly, but at least it is not a silent breaking change.
>
> I say "leftmost" and "rightmost" because folds over dictionaries pass
> three arguments to the folding function: (key value accumulation).

I'm going to go with the current semantics and R6RS-style names
array-fold-left and array-fold-right.

Brad