sequences: change binary-reduce not to be row-polymorphic until #879 is fixed.

db4
John Benediktsson 2013-05-06 16:17:57 -07:00
parent 1216ae5cb1
commit a5bc30ba42
2 changed files with 3 additions and 3 deletions

View File

@ -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:"

View File

@ -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 )