reduce-outputs ( quot operation -- )
Factor documentation > Factor handbook > The language > Combinators > Smart combinators
Prev:output>array ( quot -- array )
Next:map-reduce-outputs ( quot mapper reducer -- quot )


Vocabulary
combinators.smart

Inputs and outputs
quota quotation
operationa quotation


Word description
Infers the number of outputs from quot and reduces them using operation. The identity for the reduce operation is the first output.

Examples
USING: combinators.smart kernel math prettyprint ; 3 [ [ 4 * ] [ 4 / ] [ 4 - ] tri ] [ * ] reduce-outputs .
-9


Definition
USING: generalizations kernel ;

IN: combinators.smart

: reduce-outputs ( quot operation -- )
[ [ call ] [ [ drop ] compose outputs ] bi ] dip
swap call-n ; inline