Handbook
Glossary
smart-apply ( quot n -- )
Factor handbook
»
The language
»
Combinators
»
Smart combinators
Prev:
map-reduce-outputs ( quot mapper reducer -- quot )
Next:
sum-outputs ( quot -- n )
Vocabulary
combinators
.
smart
Inputs
quot
a
quotation
n
an
integer
Outputs
None
Word description
Applies a quotation to the datastack
n
times, starting lower on the stack and working up in increments of the number of inferred inputs to the quotation.
Examples
USING: combinators.smart prettyprint math kernel ; 1 2 3 4 [ + ] 2 smart-apply [ . ] bi@
3 7
Definition
USING:
generalizations
kernel
;
IN:
combinators.smart
:
smart-apply
( quot n -- )
[
dup
inputs
]
dip
mnapply
;
inline