2bi ( x y p q -- )

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

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

Prev: | bi ( x p q -- ) |

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

Vocabulary

kernel

Inputs

Outputs

None

Word description

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

Examples

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

If [ p ] and [ q ] have stack effect ( x y -- z ), 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 -- ... ) |

Outputs

None

Word description

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

Examples

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

[ p ] [ q ] 2bi
2dup p q

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

[ p ] [ q ] 2bi
2dup p -rot q

In general, the following two lines are equivalent:

[ p ] [ q ] 2bi
[ p ] 2keep q

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 (2173, heads/master-f3ee5c5979, Sep 18 2022 13:17:51)