Formal comment #170 (enhancement)
asymmetry between fold-left and fold-right
Reported by: Sven Hartrumpf
Version: 5.92
Component: Lists
Argument order of "combine" (or "kons") for fold-left differs from the
one for fold-right (and the popular SRFI-1).
A common change in program development is switching from fold-left to
fold-right (or vice versa). With the above inconsistency, such changes
become unnecessarily complex.
Furthermore, many people think of "combine" as "kons", which in
analogy to cons should have the "smaller, one-element" argument first,
and the "larger, all-the-remaining-elements" argument second.
RESPONSE:
It is not clear that supporting switching from `fold-left' to
`fold-right' or vice versa without regard to the semantic differences
between them justifies the potential confusion.
Different programmers have different intuitions and expectations as to
the argument order of `fold-left' and `fold-right', as shown by the
discussion on r6rs-discuss. Thus, it is not clear that any particular
convention is superior. The (r6rs lists) library is deliberately not
a subset of SRFI 1. The editors chose the convention they perceived
as most popular among the various Scheme implementations, SRFI 1, as
well as other functional languages that offer similar procedures. The
editors reconsidered the issue, but were still in favor of the
conventions specified in R5.92RS.