mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-04-30 11:50:28 +02:00
Reduce-right not limited by stack
* module/srfi/srfi-1.scm (reduce-right): Avoid blowing out the stack. Fixes #17485.
This commit is contained in:
parent
61b8794e04
commit
9c783616cc
1 changed files with 1 additions and 4 deletions
|
@ -557,10 +557,7 @@ then that's the return value."
|
||||||
F is on two elements from LST, rather than one element and a given
|
F is on two elements from LST, rather than one element and a given
|
||||||
initial value. If LST is empty, RIDENTITY is returned. If LST
|
initial value. If LST is empty, RIDENTITY is returned. If LST
|
||||||
has just one element then that's the return value."
|
has just one element then that's the return value."
|
||||||
(check-arg procedure? f reduce)
|
(reduce f ridentity (reverse lst)))
|
||||||
(if (null? lst)
|
|
||||||
ridentity
|
|
||||||
(fold-right f (last lst) (drop-right lst 1))))
|
|
||||||
|
|
||||||
(define map
|
(define map
|
||||||
(case-lambda
|
(case-lambda
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue