Stream: helpdesk (published)

Topic: Pushing to a `quote`-block


view this post on Zulip Mosè Giordano (Apr 24 2023 at 16:44):

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

Last updated: Oct 02 2023 at 04:34 UTC