Currently open the problem to create such a statement, but now you can save the syntax:
julia> h(x) = f(g(x))
or a little more clearly (for more complex functions):
julia> h(x) = x |> g |> f
It seems you now need to save x to create its composite function.
Another option is to create your own operator (as you think):
julia> ∘(f::Function, g::Function) = x->f(g(x)) julia> h = f ∘ g
This works fine, however it introduces a lambda function, and I cannot imagine a way to perform such an operation without lambdas.
NOTE. The ∘ operator can be written as \ circ as suggested by @DanGetz.
EDIT: It seems that quick closures will appear in future releases and it will probably be easy to implement an efficient version of the compound statement.
Imanol luengo
source share