nkeep ( n -- )
Factor handbook » The language » Combinators » Generalized shuffle words and combinators » Generalized combinators

Prev:ndip ( n -- )
Next:napply ( quot n -- )


Vocabulary
generalizations

Inputs
nan integer


Outputs
None

Word description
A generalization of keep that can work for any stack depth. The first n items after the quotation will be saved, the quotation called, and the items restored.

Examples
USING: generalizations kernel prettyprint sequences.generalizations ; 1 2 3 4 5 [ drop drop drop drop drop 99 ] 5 nkeep 6 narray .
{ 99 1 2 3 4 5 }

Some core words expressed in terms of nkeep:
keep1 nkeep
2keep2 nkeep
3keep3 nkeep


Definition