diff --git a/core/sequences/sequences-docs.factor b/core/sequences/sequences-docs.factor index 9be1be2609..5e775230f8 100644 --- a/core/sequences/sequences-docs.factor +++ b/core/sequences/sequences-docs.factor @@ -1301,7 +1301,7 @@ HELP: collector HELP: binary-reduce { $values - { "seq" sequence } { "start" integer } { "quot" { $quotation "( ... elt1 elt2 -- ... newelt )" } } + { "seq" sequence } { "start" integer } { "quot" { $quotation "( elt1 elt2 -- newelt )" } } { "value" object } } { $description "Like " { $link reduce } ", but splits the sequence in half recursively until each sequence is small enough, and calls the quotation on these smaller sequences. If the quotation computes values that depend on the size of their input, such as bignum arithmetic, then this algorithm can be more efficient than using " { $link reduce } "." } { $examples "Computing factorial:" diff --git a/core/sequences/sequences.factor b/core/sequences/sequences.factor index caaed80efa..55e95c5cf8 100644 --- a/core/sequences/sequences.factor +++ b/core/sequences/sequences.factor @@ -892,7 +892,7 @@ PRIVATE> : nth3-unsafe ( n seq -- a b c ) [ nth2-unsafe ] [ [ 2 + ] dip nth-unsafe ] 2bi ; inline -: (binary-reduce) ( ... seq start quot: ( ... elt1 elt2 -- ... newelt ) from length -- ... value ) +: (binary-reduce) ( seq start quot: ( elt1 elt2 -- newelt ) from length -- value ) #! We can't use case here since combinators depends on #! sequences dup 4 < [ @@ -910,7 +910,7 @@ PRIVATE> PRIVATE> -: binary-reduce ( ... seq start quot: ( ... elt1 elt2 -- ... newelt ) -- ... value ) +: binary-reduce ( seq start quot: ( elt1 elt2 -- newelt ) -- value ) pick length 0 max 0 swap (binary-reduce) ; inline : cut ( seq n -- before after )