Implementation of reduce-right in SRFI 1
TAKIZAWA Yozo 28 Dec 2021 08:49 UTC
Although this is not a specification topic but implementation, I send
it to the list as a related issue to confirm or clarify.
I found that many implementations of reduce-right, including the
reference implementation, seem to be defined as a left-to-right
version of the implementation of reduce, regardless of describing in
SRFI 1 which is (fold-right f ridentity list) under (f x ridentity) =
x. Is there any special reason for such definitions?
It is not a problem as long as (f x ridentity) = x, to define
concatenate for example. But I experienced being confused when (f x
ridentity) is not x, it is my fault of course, with different results
between actual Scheme implementations... And, I am making a toy LISP
implementation for my fun and educational purpose especially to show
fold/unfold usages so I want to know about the above issue also to
define as one of the samples.
Best regards,
--
TAKIZAWA Yozo