tri ( x p q r -- )

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

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

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:

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:

See also

bi, cleave

Definition

kernel

Inputs

x | an object |

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

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

r | a 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

This documentation was generated offline from a
`load-all`

image. If you want, you can also
browse the documentation from within the UI developer tools. See
the Factor website
for more information.

Factor 0.99 x86.64 (2203, heads/master-424edf64aa, Mar 8 2023 13:48:50)