You need to use 'esc' -- see the hygiene part of the metaprog section in the manual. On Jan 14, 2015 8:56 AM, "yi lu" <zhiwudazhanjiang...@gmail.com> wrote:
> Hi, > > I am able to write a simple macro to drop brackets. > https://gist.github.com/eccstartup/36637d96355bd5ca8188 > > But there is some problem with this. > > You can see the @nobrace macro that drop brackets of functions. > For example: > ``` > @nobrace map (x->x^2-1) 1:0.01:2 > ``` > get a list of Float numbers. This is fine. > > However, in the macro, we cannot see global variables. > For example: > ``` > arr = @nobrace map (x->x^2-1) 1:0.01:2 > print(arr) > ``` > will print the "arr" list, but > ``` > arr = @nobrace map (x->x^2-1) 1:0.01:2 > @nobrace print arr > ``` > will report "arr not found". > > Is there a remedy? > > > Yours, > Yi >