juliafunction-composition

ASCII alternative to the Julia function composition (∘) operator?


Is there an ASCII alias for the function composition operator in Julia, ?

In general, is there a way to find ASCII/Unicode variants of operators?

julia> ∘
∘ (generic function with 2 methods)

^Tried this, for example has an alternative:

julia> ≈
isapprox (generic function with 8 methods)

Solution

  • You can use ComposedFunction(f, g) on Julia 1.6 and above:

    julia> ComposedFunction(-, exp)
    (-) ∘ exp
    

    Of course, it's a bit cumbersome, because you'd need to nest to compose more functions:

    julia> ComposedFunction(-, ComposedFunction(exp, adjoint))
    (-) ∘ (exp ∘ adjoint)