curry ( obj quot -- curry ) - Factor Documentation

curry ( obj quot -- curry )
Callables

Next: curried


Vocabulary
kernel

Inputs
obj an object
quot a callable


Outputs
curry a curried


Word description
Partial application. Outputs a callable which first pushes obj and then calls quot.

Notes
Even if obj is a word, it will be pushed as a literal.

This operation is efficient and does not copy the quotation.

Examples
USING: kernel prettyprint ; 5 [ . ] curry .
[ 5 . ]

USING: kernel prettyprint see ; \ = [ see ] curry .
[ \ = see ]

USING: kernel math prettyprint sequences ; { 1 2 3 } 2 [ - ] curry map .
{ -1 0 1 }


See also
curried , compose , prepose , composed

Definition
USING: classes.tuple.private quotations slots ;

IN: kernel

: curry ( obj quot -- curry )
dup callable? [ \ callable bad-slot-value ] unless
{ curried 2 1 tuple 236985587512 curried 348433631669 }
<tuple-boa> ; flushable

AltStyle によって変換されたページ (->オリジナル) /