Well, I don't get it very clearly. I learnt that 'esc' changes variable
names of a local variable in the macro. But I want to reference the global
variable out of the macro. I have little idea of Lisp macros, so I think I
still cannot handle this.
Would you please add more details?

Yi

On Wed, Jan 14, 2015 at 11:37 PM, Isaiah Norton <isaiah.nor...@gmail.com>
wrote:

> 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
>>
>

Reply via email to