有没有办法从列表的表达式到朱莉娅的表达式列表,而无需评估中介?
即
julia> l = :([1, 2+x, 5, 3/x])
:([1, 2 + x, 5, 3 / x])
julia> @eval [$(quote e end) for e in $l]
ERROR: UndefVarError: x not defined
理想的状态是:
[1, :(2 + x), 5, :(3 / x)])
这是做到这一点的方法(如果我正确理解你想要的):
julia> l.args
4-element Array{Any,1}:
1
:(2 + x)
5
:(3 / x)