macro superM(arg, argc)
map(foo,argc)
end
@superM test {1,2}
I just want to passe the argument argc to the map function, but I'm getting this error: no method matching iterate(::Expr)
macro superM(arg, argc)
map(foo,argc)
end
@superM test {1,2}
I just want to passe the argument argc to the map function, but I'm getting this error: no method matching iterate(::Expr)
the argc is an Expression whose head is braces {}:
julia> dump(:({1, 2}))
Expr
head: Symbol braces
args: Array{Any}((2,))
1: Int64 1
2: Int64 2
so what you really want is the args field of the expression {1,2}
julia> macro superM(arg, argc)
map(identity,argc.args)
end
@superM (macro with 1 method)
julia> @superM test {1,2}
2-element Vector{Int64}:
1
2