tri-curry ( x p q r -- p' q' r' )

Factor handbook » The language » Combinators » Compositional combinators » Curried dataflow combinators

Factor handbook » The language » Combinators » Compositional combinators » Curried dataflow combinators

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

Next: | bi-curry* ( x y p q -- p' q' ) |

Vocabulary

kernel

Inputs

Outputs

Word description

Partially applies p, q and r to x.

Notes

The following two lines are equivalent:

Higher-arity variants of tri can be built from tri-curry:

The combination tri-curry tri* cannot be expressed with the non-currying dataflow combinators alone; it handles the case where you have four values a b c d on the stack, and you wish to apply p to a d, q to b d and r to c d.

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

p' | [ x p ] |

q' | [ x q ] |

r' | [ x r ] |

Word description

Partially applies p, q and r to x.

Notes

The following two lines are equivalent:

[ p ] [ q ] [ r ] tri-curry [ call ] tri@
[ p ] [ q ] [ r ] tri

Higher-arity variants of tri can be built from tri-curry:

[ p ] [ q ] [ r ] tri-curry tri == [ p ] [ q ] [ r ] 2tri
[ p ] [ q ] [ r ] tri-curry tri-curry bi == [ p ] [ q ] [ r ] 3tri

The combination tri-curry tri* cannot be expressed with the non-currying dataflow combinators alone; it handles the case where you have four values a b c d on the stack, and you wish to apply p to a d, q to b d and r to c d.

Definition