Cool. $(symbol("gen_$x")) might also be a bit more compact, now I think
about it.

On 7 January 2015 at 02:00, Chi-wei Wang <[email protected]> wrote:

> Exactly what I want! Thanks!
>
> Mike Innes於 2015年1月7日星期三UTC+8上午9時34分21秒寫道:
>>
>> Is $(symbol(string("gen_", x))) what you're looking for?
>>
>> On 7 January 2015 at 01:28, Chi-wei Wang <[email protected]> wrote:
>>
>>> Hi, everyone.
>>>
>>> I'd like to do something like following C code in Julia.
>>>
>>> #define gen_func(x) \
>>> void f_##x() { \
>>> }
>>>
>>> I tried the following Julia code, but I have no idea how to get 'gen_'
>>> appended in front of the function name.
>>>
>>> macro gen_func(x)
>>>   return esc(quote
>>>     function $x()
>>>         # do something
>>>     end
>>>   end)
>>> end
>>>
>>>
>>>
>>>
>>

Reply via email to