bi-curry ( x p q -- p' q' )
Factor handbook > The language > Combinators > Compositional combinators > Curried dataflow combinators

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


Vocabulary
kernel

Inputs and outputs
xan object
pa quotation with stack effect ( x -- ... )
qa quotation with stack effect ( x -- ... )
p'[ x p ]
q'[ x q ]


Word description
Partially applies p and q to x.

Notes
The following two lines are equivalent:
[ p ] [ q ] bi-curry [ call ] bi@ [ p ] [ q ] bi

Higher-arity variants of bi can be built from bi-curry:
[ p ] [ q ] bi-curry bi == [ p ] [ q ] 2bi [ p ] [ q ] bi-curry bi-curry bi == [ p ] [ q ] 3bi

The combination bi-curry bi* cannot be expressed with the non-currying dataflow combinators alone; it is equivalent to a stack shuffle preceding 2bi*:
[ p ] [ q ] bi-curry bi* [ swap ] keep [ p ] [ q ] 2bi*

To put it another way, bi-curry bi* handles the case where you have three values a b c on the stack, and you wish to apply p to a c and q to b c.

Definition