composed - Factor Documentation (original) (raw)

composed
Callables

Prev: compose ( quot1 quot2 -- compose )

Vocabulary
kernel

Class description
The class of objects created by compose. These objects print identically to quotations and implement the sequence protocol, however they only use two cells of storage; references to the first and second underlying quotations.

See also
curry, curried, compose, prepose

Definition

IN: kernel

TUPLE: composed { first read-only } { second read-only } ;

Methods

USING: accessors compiler.tree.propagation.call-effect kernel ;

M: composed add-quot-to-history
[ first>> add-quot-to-history ]
[ second>> add-quot-to-history ] bi ;

USING: accessors combinators.short-circuit
compiler.tree.propagation.call-effect kernel ;

M: composed already-inlined-quot?
{
[ first>> already-inlined-quot? ]
[ second>> already-inlined-quot? ]
} 1|| ;

USING: accessors compiler.tree.propagation.call-effect kernel ;

M: composed cached-effect
[ first>> ] [ second>> ] bi [ cached-effect ] bi@
compose-effects* ;

USING: kernel quotations.private ;

M: composed call uncompose [ call ] dip call ;

USING: accessors kernel math sequences ;

M: composed length [ first>> length ] [ second>> length ] bi + ;

USING: kernel prettyprint.custom ;

M: composed pprint* pprint-object ;

USING: kernel prettyprint.custom ;

M: composed pprint-delims drop \ [ \ ] ;

USING: accessors kernel sequences ;

M: composed virtual-exemplar first>> ;

USING: accessors kernel math sequences ;

M: composed virtual@
2dup first>> length <
[ first>> ] [ [ first>> length - ] [ second>> ] bi ] if ;