Like this:

julia> macro gf(n)
       quote
       function $(esc(n))()
       1
       end
       end
       end

julia> @gf foo
foo (generic function with 1 method)

julia> foo()
1

On Thu, 2015-05-28 at 12:06, Vasudha Khandelwal <vasudhakhandelw...@gmail.com> 
wrote:
> Can I use macros to generate functions with names passed as argument to the 
> macro? 

Reply via email to