Using metaprogramming to combine multiple functions and construct a composite temporary function

What is the context here that is leading you towards metaprogramming (which is often a bad idea)? Why not just write something like

function f(x, y)
    z1 = f1(x, y)
    z2 = f2(z1)
    z3 = f3(z2)
    z4 = f4(z1, z3)
    z5 = f5(z1)
    return (; z1, z2, z3, z4, z5)
end

if that is the function composition you want? That is, why are you defining a custom function-composition representation using a Dict of symbols rather than using the Julia language itself?

1 Like