Preserving combinators
Factor documentation > Factor handbook > The language > Combinators > Dataflow combinators
Next:Cleave combinators


Sometimes it is necessary to temporarily hide values on the datastack. The dip combinators invoke the quotation at the top of the stack, hiding some number of values underneath:
dip ( x quot -- x )

2dip ( x y quot -- x y )

3dip ( x y z quot -- x y z )

4dip ( w x y z quot -- w x y z )


The keep combinators invoke a quotation and restore some number of values to the top of the stack when it completes:
keep ( x quot -- x )

2keep ( x y quot -- x y )

3keep ( x y z quot -- x y z )