From a5bc30ba426d18e81c5d45703e23bdf92b7365d3 Mon Sep 17 00:00:00 2001 From: John Benediktsson Date: Mon, 6 May 2013 16:17:57 -0700 Subject: [PATCH] sequences: change binary-reduce not to be row-polymorphic until #879 is fixed. --- core/sequences/sequences-docs.factor | 2 +- core/sequences/sequences.factor | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) 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 ) -- 2.34.1