kons argument order in vector-map Bradley Lucier (30 Jan 2024 01:12 UTC)
Re: kons argument order in vector-map Marc Nieper-Wißkirchen (30 Jan 2024 06:13 UTC)
(missing)
Re: kons argument order in vector-map Marc Nieper-Wißkirchen (30 Jan 2024 06:33 UTC)
Re: kons argument order in vector-map Bradley Lucier (30 Jan 2024 17:33 UTC)

kons argument order in vector-map Bradley Lucier 30 Jan 2024 01:12 UTC

SRFI 1 has
======================
(fold kons knil lis) = (fold kons (kons (car lis) knil) (cdr lis))
(fold kons knil '()) = knil
======================
with the example
======================
(fold cons '() lis)		; Reverse LIS.
======================
So the state, knil, is the rightmost argument (when there are multiple
list arguments to fold).

SRFI 133 says
======================
kons is applied as (kons state (vector-ref vec1 i) (vector-ref vec2 i)
...) where state is the current state value.
======================
So the state is the leftmost argument.

I haven't gone through the SRFI 133 mail-list discussion, and there is
the example:
======================
Produce a list of the reversed elements of vec:

(vector-fold (λ (tail elt) (cons elt tail)) '() vec)
======================

So the argument order to vector-fold seems (a) reasonable as a choice,
and (b) incompatible with SRFI 1.

Am I understanding this correctly?

Brad