Thanks for insisting on the fact that I can use functions:
I finally realized that I have to build the expression like that:
f = :($x_1*$x_2+z*inv($x_3))
With this expression and the use of MacroTools.postwalk
, I was able to construct the functions I need.
(Up to now I always used f = :(x_1*x_2+z*inv(x_3))
.)