Left folds Bradley Lucier (17 Sep 2022 22:18 UTC)
Re: Left folds Marc Nieper-Wißkirchen (18 Sep 2022 08:44 UTC)
(missing)
(missing)
Re: Left folds Bradley Lucier (20 Sep 2022 14:15 UTC)
Re: Left folds Marc Nieper-Wißkirchen (20 Sep 2022 14:25 UTC)
Re: Left folds Marc Nieper-Wißkirchen (22 Sep 2022 20:52 UTC)
Re: Left folds Lucier, Bradley J (22 Sep 2022 21:14 UTC)
Re: Left folds Marc Nieper-Wißkirchen (23 Sep 2022 09:25 UTC)
Re: Left folds John Cowan (23 Sep 2022 17:22 UTC)
Re: Left folds Marc Nieper-Wißkirchen (23 Sep 2022 17:30 UTC)
Re: Left folds Bradley Lucier (23 Sep 2022 18:39 UTC)
Re: Left folds Bradley Lucier (24 Sep 2022 00:12 UTC)
Re: Left folds Arthur A. Gleckler (24 Sep 2022 00:24 UTC)
Fwd: Left folds Marc Nieper-Wißkirchen (20 Sep 2022 14:17 UTC)
Re: Left folds John Cowan (18 Sep 2022 10:41 UTC)
Re: Left folds Marc Nieper-Wißkirchen (18 Sep 2022 13:29 UTC)
Re: Left folds Bradley Lucier (20 Sep 2022 00:32 UTC)

Re: Left folds Bradley Lucier 20 Sep 2022 14:14 UTC

On 9/20/22 2:02 AM, Marc Nieper-Wißkirchen wrote:
> Is there a reason why you cite Haskell's fold procedures?  After all,
> Scheme has such procedures as well (SRFI 1 and R6RS).

(CC'ing the mail list.)

SRFI 1 specifies:

  fold kons knil clist1 clist2 ... -> value

     The fundamental list iterator.

     First, consider the single list-parameter case. If clist1 = (e1 e2
... en), then this procedure returns
     (kons en ... (kons e2 (kons e1 knil)) ... )

So kons is called with the elements of the list as the left argument.

The same is true for fold-right.

In SRFI 231, as in Haskell and Ocaml, as I understand it, foldl calls
kons with the list element as the right argument, and foldr calls kons
with the list element as the left argument.

I chose this convention because I was thinking of things like matrix
multiply, which would have a left identity (use array-foldl) and a
different right identity (use array-foldr).

Brad