Not with a function, but you can do that with a macro:

julia> macro capture(ex)
           Expr(:quote, ex)
       end

julia> @capture(1+5)
:(1 + 5)

julia> @capture(var)
:var


On Wed, Jun 24, 2015 at 5:27 PM, JuliaFan <[email protected]> wrote:

> Is it possible to capture arguments passed to a function as expression?
>
> E.g. function capture(src)
>
> capture(1+5) -> :(1+5)
> capture(var) -> :(var)
>
> Thanks
>
>

Reply via email to