}
} ;
-HELP: reduce-output
+HELP: reduce-outputs
{ $values
{ "quot" quotation } { "operation" quotation }
{ "newquot" quotation }
{ $examples
{ $example
"USING: combinators.smart kernel math prettyprint ;"
- "3 [ [ 4 * ] [ 4 / ] [ 4 - ] tri ] [ * ] reduce-output ."
+ "3 [ [ 4 * ] [ 4 / ] [ 4 - ] tri ] [ * ] reduce-outputs ."
"-9"
}
} ;
{ $subsection output>sequence }
{ $subsection output>array }
"Reducing the output of a quotation:"
-{ $subsection reduce-output }
+{ $subsection reduce-outputs }
"Summing the output of a quotation:"
{ $subsection sum-outputs } ;
-[ 6 ] [ [ 1 2 3 ] [ + ] reduce-output ] unit-test
+[ 6 ] [ [ 1 2 3 ] [ + ] reduce-outputs ] unit-test
-[ [ 1 2 3 ] [ + ] reduce-output ] must-infer
+[ [ 1 2 3 ] [ + ] reduce-outputs ] must-infer
[ 6 ] [ [ 1 2 3 ] sum-outputs ] unit-test
[ infer in>> ] keep
'[ _ firstn @ ] ;
-MACRO: reduce-output ( quot operation -- newquot )
+MACRO: reduce-outputs ( quot operation -- newquot )
[ dup infer out>> 1 [-] ] dip n*quot compose ;
: sum-outputs ( quot -- n )
- [ + ] reduce-output ; inline
+ [ + ] reduce-outputs ; inline