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

Vocabulary
kernel

Inputs

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