Interpolation of expression

There are lots of useful macros in Base.Cartesian for this sort of thing:

julia> @macroexpand @nextract 3 x d->2d
quote
    x_1 = 2
    x_2 = 4
    x_3 = 6
end