keep ( ..a x quot: ( ..a x -- ..b ) -- ..b x )
Factor handbook > The language > Combinators > Dataflow combinators > Preserving combinators

Prev:4dip ( w x y z quot -- w x y z )
Next:2keep ( ..a x y quot: ( ..a x y -- ..b ) -- ..b x y )


Vocabulary
kernel

Inputs and outputs
xan object
quota quotation with stack effect ( ..a x -- ..b )


Word description
Call a quotation with a value on the stack, restoring the value when the quotation returns.

Examples
USING: arrays kernel prettyprint ; 2 "greetings" [ <array> ] keep 2array .
{ { "greetings" "greetings" } "greetings" }


Definition

: keep ( ..a x quot: ( ..a x -- ..b ) -- ..b x )
over [ call ] dip ; inline