2tri ( x y p q r -- )

Factor handbook » The language » Combinators » Dataflow combinators » Cleave combinators

Factor handbook » The language » Combinators » Dataflow combinators » Cleave combinators

Prev: | tri ( x p q r -- ) |

Next: | 3tri ( x y z p q r -- ) |

Vocabulary

kernel

Inputs

Outputs

None

Word description

Applies p to the two input values, then applies q to the two input values, and finally applies r to the two input values.

Examples

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

In general, the following two lines are equivalent:

Definition

kernel

Inputs

x | an object |

y | an object |

p | a quotation with stack effect ( x y -- ... ) |

q | a quotation with stack effect ( x y -- ... ) |

r | a quotation with stack effect ( x y -- ... ) |

Outputs

None

Word description

Applies p to the two input values, then applies q to the two input values, and finally applies r to the two input values.

Examples

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

[ p ] [ q ] [ r ] 2tri
2dup p 2dup q r

In general, the following two lines are equivalent:

[ p ] [ q ] [ r ] 2tri
[ p ] 2keep [ q ] 2keep r

Definition