API
Modules
Types and constants
Functions and macros
FunctionChains.asfunction
FunctionChains.fchain
FunctionChains.typed_callable
FunctionChains.with_intermediate_results
Documentation
FunctionChains.FunctionChains
— Modulemodule FunctionChains
Implements chained functions (composed functions) beyond Base.ComposedFunction
.
FunctionChains.AsFunction
— Typestruct FunctionChains.AsFunction{F} <: Function
Wraps a callable object to make it a Function
.
User code should typically not instantiate AsFunction
objects directly, but use asfunction(f)
instead.
FunctionChains.FunctionChain
— Typestruct FunctionChain{FS}<:Function
Represents a chain of composed functions.
A FunctionChain
has a single field fs
which may be a tuple, array or generator/iterator of functions.
(chain::FunctionChain)(x)
applies the functions in the cain in order of iteration over chain.fs
. ```
Supports with_intermediate_results
. Also supports InverseFunctions.inverse
and/or ChangesOfVariables.with_logabsdet_jacobian
if all functions in the chain do so.
Use fchain
to construct function chains instead of FunctionChain(fs)
.
FunctionChains.asfunction
— Functionasfunction(f)::Function
asfunction(f::Function) === f
Wraps a callable f
to make it a Function
.
If f isa Function
, simply returns f. If f
is A type (constructor), returns a properly typed function object.
FunctionChains.fchain
— Functionfchain()
fchain(fs)
Construct a function chain of functions fs
.
Typically returns a FunctionChain
, but may be specialized to return other function chain types for specific types of functions.
fs
must be iterable, it may be a tuple, vector, generator, etc. fchain(fs)(x)
will apply the functions in fs
in order of iteration.
FunctionChains.typed_callable
— Functiontyped_callable(f)
Wraps a callable f
in a typed function object if necessary, e.g. if f
is a type (constructor).
FunctionChains.with_intermediate_results
— Functionwith_intermediate_results(f, x)
Apply multi-step function f
to x
and return a collection that contains the intermediate results and the final result.