I meant something like this

julia> macro mymacro(a,b,c)
       println(c)
       end

julia> @mymacro("aaa", ("bbb", "ccc")...)
ERROR: wrong number of arguments

which works fine for functions

julia> function myfunc(a,b,c)
       println(c)
       end
myfunc (generic function with 1 method)

julia> myfunc("aaa", ("bbb", "ccc")...)
ccc




On Friday, August 29, 2014 6:02:45 PM UTC-7, Jameson wrote:
>
> splicing into a macro works for me:
>
> julia> macro mymacro(a,b)
>        println(b)
>        end
>
> julia> @mymacro(x, y...)
> y...
>
> ​
>
>
> On Fri, Aug 29, 2014 at 8:57 PM, Don MacMillen <[email protected] 
> <javascript:>> wrote:
>
>> The slides are great.  Many thanks for sharing.
>>
>> I do have a question about macros that maybe you can answer.  In your nb 
>> on
>> metaprogramming you have the horner macro listed and it uses a temporary
>> variable t.  But this macro can be written without using a temporary 
>> variable.
>> It turns out to be slower (the no temp version) if we are computing a 
>> bunch of 
>> polynomials with the same coefficients, but is a tiny bit faster if the 
>> coefficients 
>> are always changing. So are the Expr's cached? Or is something else going 
>> on?
>>
>> Also (OK I have two questions) it looks like we cannot splice into a 
>> macro call?
>> Ie  @mymacro(x, y...) doesn't work?
>>
>> Thanks again.
>>
>> Don
>>
>>
>> On Friday, August 29, 2014 4:08:44 AM UTC-7, Steven G. Johnson wrote:
>>>
>>> I just gave a talk on Julia at EuroSciPy, and managed to escape alive.  
>>> :-)
>>>
>>> I think they will post a video at some point, but in the meantime the 
>>> slides and IJulia notebooks are posted at:
>>>
>>>        https://github.com/stevengj/Julia-EuroSciPy14
>>>
>>> --SGJ
>>>
>>
>

Reply via email to