Factor Documentation
|
Home
|
Glossary
|
Search
factorcode.org
sum-outputs ( quot -- n )
Factor documentation
>
Factor handbook
>
The language
>
Combinators
>
Smart combinators
Prev:
smart-apply ( quot n -- )
Next:
append-outputs ( quot -- seq )
Vocabulary
combinators.smart
Inputs and outputs
quot
a
quotation
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