Subject: Re: bug#17485: (srfi srfi-1) reduce-right does not scale, version 2.0.9
From: Andy Wingo <[email-masked]>
To: David Kastrup <[email-masked]>
Cc: [email-masked]
Date: Tue, 12 Jul 2016 09:07:58 +0200
List-Id: <debbugs-submit.debbugs.gnu.org>

On Tue 21 Jun 2016 17:31, David Kastrup <[email-masked]> writes:

> Andy Wingo <[email-masked]> writes:
>
>> I think on 2.0 that this might be an OK workaround:
>>
>>  (define (reduce-right f ridentity lst)
>>    (reduce f ridentity (reverse lst)))
>
> So if we don't store the inverse list in-space, it needs to be either a
> copy in heap (reverse) or stack (recursion).  Stack allocation is likely
> cheaper in execution time (though the total memory cost depends on the
> stack frame size taken per call).  The limited stack size on 2.0 does
> not seem like a good fit, however.  Which makes your workaround seem
> like the best option.

Applied this fix to stable-2.0.  Thanks for the report.

Andy