Handbook
Glossary
sum-outputs ( quot -- n )
Factor handbook
»
The language
»
Combinators
»
Smart combinators
Prev:
smart-apply ( quot n -- )
Next:
append-outputs ( quot -- seq )
Vocabulary
combinators
.
smart
Inputs
quot
a
quotation
Outputs
n
an
integer
Word description
Infers the number of outputs from
quot
and returns their sum.
Examples
USING: combinators.smart kernel math prettyprint ; 10 [ [ 1 - ] [ 1 + ] bi ] sum-outputs .
20
Definition
USING:
math
;
IN:
combinators.smart
:
sum-outputs
( quot -- n )
[
+
]
reduce-outputs
;
inline