Hi,
I’m trying to generate a function (or an expression which evaluates to function to be precise) where arguments are given by a vector of symbols, perhaps easiest explained by this example:
function fexpr()
vars = [:x,:y,:z]
quote
function($(vars...))
$(vars[1]) + $(vars[2]) * $(vars[3])
end
end
end
The above fails (doesn’t compile) with the error message ERROR: syntax: expected "(" in function definition
.
In case it is not clear, I would like the above to result in the same as this:
function fexpr()
vars = [:x,:y,:z]
quote
function(x,y,z)
$(vars[1]) + $(vars[2]) * $(vars[3])
end
end
end