with ( param obj quot -- obj curried )
Factor handbook » The language » Combinators » Compositional combinators

Prev:3curry ( obj1 obj2 obj3 quot -- curried )
Next:prepose ( quot1 quot2 -- composed )


Vocabulary
kernel

Inputs
paraman object
objan object
quota quotation with stack effect ( param elt -- ... )


Outputs
objan object
currieda curried


Word description
Similar to how curry binds the element below its quotation as its first argument, with binds the second element below quot as the second argument of quot.

In other words, partial application on the left. The following two lines are equivalent:
swap [ swap A ] curry B

[ A ] with B


Notes
This operation is efficient and does not copy the quotation.

Examples
USING: kernel math prettyprint sequences ; 1 { 1 2 3 } [ / ] with map .
{ 1 1/2 1/3 }

USING: kernel math prettyprint sequences ; 1000 100 5 <iota> [ sq + + ] 2with map .
{ 1100 1101 1104 1109 1116 }


Definition

: with ( param obj quot -- obj curried )
swapd [ swapd call ] 2curry ; inline