Can ... be applied on macro? I tried this but it didn't compile. macro f(a,b,c) return :($a+$b+$c) end const A = (2,3) @f(1, A...)
Chi-wei Wang於 2015年1月7日星期三UTC-8下午6時45分14秒寫道: > > It works! I missed the varargs section in the doc. Thanks! > > Greg Plowman於 2015年1月7日星期三UTC-8下午5時26分02秒寫道: >> >> >> Would the following work? >> >> const A = (1,2,3) >> f(x::Int, y::Int, z::Int) = x+y+z >> f(A...) >> >> >> >> http://docs.julialang.org/en/release-0.3/manual/functions/#varargs-functions >> >> >> On Thursday, January 8, 2015 11:14:23 AM UTC+11, Chi-wei Wang wrote: >> >>> Hi, everyone. I am trying to achieve the effect like the following C >>> code: >>> >>> #define A 1,2,3 >>> void f(int x, int y, int z) { >>> } >>> >>> f(A); >>> >>> Yet the macro in Julia always returns a single expression. Is it >>> possible to do this? >>> >>
