tri ( x p q r -- )
Factor handbook » The language » Combinators » Dataflow combinators » Cleave combinators

Prev:3bi ( x y z p q -- )
Next:2tri ( x y p q r -- )


Vocabulary
kernel

Inputs
xan object
pa quotation with stack effect ( x -- ... )
qa quotation with stack effect ( x -- ... )
ra quotation with stack effect ( x -- ... )


Outputs
None

Word description
Applies p to x, then applies q to x, and finally applies r to x.

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

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

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


See also
bi, cleave

Definition

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