bi ( x p q -- )
Factor documentation > Factor handbook > The language > Combinators > Dataflow combinators > Cleave combinators
Next:2bi ( x y p q -- )


Vocabulary
kernel

Inputs and outputs
xan object
pa quotation with stack effect ( ..a x -- ..b )
qa quotation with stack effect ( ..c x -- ..d )


Word description
Applies p to x, then applies q to x.

Examples
If [ p ] and [ q ] have stack effect ( x -- ), then the following two lines are equivalent:
[ p ] [ q ] bi dup p q

If [ p ] and [ q ] have stack effect ( x -- y ), then the following two lines are equivalent:
[ p ] [ q ] bi dup p swap q

In general, the following two lines are equivalent:
[ p ] [ q ] bi [ p ] keep q


See also
tri, cleave

Definition
IN: kernel

: bi ( x p q -- ) [ keep ] dip call ; inline