callable
Factor documentation > Factor handbook > The language > Collections > Quotations
Prev:quotation? ( object -- ? )
Next:Wrappers


Vocabulary
quotations

Class description
The class whose instances can be passed to call. This includes quotations and composed quotations built up with curry or compose.

Definition
USING: kernel ;

IN: quotations

UNION: callable quotation curry compose ;


Methods
USING: compiler.tree.builder.private quotations
stack-checker.backend ;

M: callable (build-tree) infer-quot-here ;


USING: arrays functors.private kernel quotations ;

M: callable >fake-quotations
>array >fake-quotations fake-quotation boa ;


USING: prettyprint.custom quotations ;

M: callable >pprint-sequence ;


USING: arrays compiler.cfg.intrinsics.simd.backend
generalizations kernel locals make quotations ;

M:: callable >vector-op-cond
( quot #pick #dup -- quotpair )
#dup quot [vector-op-checked] [ [ 2drop ] ] dip compose
#dup [ [ % ] ] dip [ nnip ] curry compose 2array ;


USING: kernel quotations sequences tools.continuations ;

M: callable add-breakpoint
dup [ break ] head? [ \ break prefix ] unless ;


USING: combinators html.templates quotations ;

M: callable call-template* ( -- ) call-effect ;


USING: macros.expander quotations sequences ;

M: callable condomize [ condomize ] map ;


USING: macros.expander quotations sequences ;

M: callable condomize? [ condomize? ] any? ;


USING: fry.private quotations sequences ;

M: callable count-inputs [ count-inputs ] map-sum ;


USING: kernel quotations sequences ;

M: callable equal?
over callable? [ sequence= ] [ 2drop f ] if ;


USING: macros.expander make quotations ;

M: callable expand-macros
[ begin (expand-macros) end ] [ ] make ;


USING: macros.expander quotations ;

M: callable expand-macros* expand-macros literal ;


USING: accessors fry fry.private kernel quotations sequences ;

M: callable fry
[ [ [ ] ] ] [
0 swap <dredge-fry>
[ dredge-fry ] [
[ prequot>> >quotation ]
[ quot>> >quotation shallow-fry ] bi append
] bi
] if-empty ;


USING: quotations stack-checker stack-checker.backend ;

M: callable infer (infer) ;


USING: kernel namespaces quotations stack-checker.backend
stack-checker.branches stack-checker.visitor ;

M: callable infer-branch
[
copy-inference nest-visitor
[ quotation set ] [ infer-quot-here ] bi
] H{ } make-assoc ;


USING: kernel quotations sequences ;

M: callable like drop dup quotation? [ >quotation ] unless ;


USING: kernel lint.private namespaces quotations sequences ;

M: callable lint
[ lint-definitions-keys get-global ] dip [ subseq? ] curry
filter ;


USING: compiler.tree.builder compiler.tree.debugger
compiler.tree.optimizer namespaces prettyprint
prettyprint.config quotations ;

M: callable optimized.
build-tree optimize-tree nodes>quot f length-limit
[ . ] with-variable ;


USING: quotations tools.crossref.private ;

M: callable quot-uses seq-uses ;


USING: locals.rewrite.sugar make quotations sequences ;

M: callable quotation-rewrite
[ [ rewrite-sugar* ] each ] [ ] make ;


USING: kernel locals.rewrite.closures locals.rewrite.point-free
locals.rewrite.sugar locals.types make quotations sequences ;

M: callable rewrite-closures*
dup free-vars [ <quote> ] map
[ % ] [ var-defs prepend (rewrite-closures) point-free , ]
[ length \ curry <repetition> % ] tri ;


USING: locals.rewrite.sugar make quotations ;

M: callable rewrite-sugar* quotation-rewrite , ;


USING: combinators destructors io io.pipes.private kernel
quotations ;

M: callable run-pipeline-element
[
[ [ ?reader ] [ ?writer ] bi* ] dip
[ ( -- result ) call-effect ] curry with-streams*
] with-destructors ;


USING: compiler.tree.propagation.inlining quotations ;

M: callable splicing-nodes splicing-body ;


USING: compiler.cfg.builder compiler.cfg.debugger
compiler.cfg.registers compiler.tree.builder
compiler.tree.optimizer namespaces quotations words ;

M: callable test-builder
0 vreg-counter set-global
build-tree optimize-tree gensym build-cfg ;


USING: hash-sets.identity kernel namespaces quotations sets
tools.crossref tools.crossref.private ;

M: callable uses
IHS{ } clone visited
[ HS{ } clone [ quot-uses ] keep members ] with-variable ;


USING: alien.private kernel namespaces quotations sequences
stack-checker.alien ;

M: callable wrap-callback-quot
swap
[ callback-parameter-quot ] [ callback-return-quot ] bi
surround wait-for-callback-hook get [ do-callback ] 2curry
>quotation ;