I have some variables, eg
What I want is to generate an array (or tuple) of the following:
[("a", 1), ("b", 2), ("c", 3)]
So far I got the conversion for one variable
macro convertarg(var) return :(($(string(var))), $(esc(var))) end
julia> @convertarg(a) ("a", 1)
My first idea was to call
convertarg in a loop from within another macro:
macro convertargs(vars...) pairs =  for var in vars append!(pairs, (@convertarg(var),)) end return pairs end
which does not work since it variables must be quoted also in
convertargs. Also directly putting the code of
convertarg at the position of the macro call does not work for the same reason. When quoting the whole expression I cannot access the macro arguments.
How can I obtain in array as wanted? I cannot wrap around that the expressions within the array must be quoted but not the returned array itself.
I am also thankfull for some explanations since I seemingly misunderstand something in how macros work.