is there an easy way to push to a quote-block without adding nested begin-blocks? for example, currently I have
julia> code = quote end
quote
#= REPL[27]:1 =#
end
julia> push!(code.args, quote a + b; c + d end);
julia> code
quote
#= REPL[27]:1 =#
begin
#= REPL[28]:1 =#
a + b
#= REPL[28]:1 =#
c + d
end
end
but I'd like to have
julia> quote
a + b
c + d
end
quote
#= REPL[30]:2 =#
a + b
#= REPL[30]:3 =#
c + d
end
the begin
comes from the quote
you're pushing being a begin
I think you want append!(code.args, (quote a + b; c + d end).args)
aaaah, append!
! I did try that, but with push!
, and got garbage, because push!
iterates over the elements to push. thanks!
Mosè Giordano has marked this topic as resolved.
Last updated: Nov 06 2024 at 04:40 UTC