Hi Tom,

I am looking for something analogous to a C++ variadic template function 
where the types as well as the arguments to the function are varags. These 
are aligned so that in my above notation T... would be a tuple/array of 
types corresponding to the types of x... and so each T[i] could be 
arbitrary.



DP

On Sunday, October 4, 2015 at 4:30:19 AM UTC+1, Tom Breloff wrote:
>
> I think maybe the function you're looking for is something like:
>
> function my_fun(::Type{T}, x...)
>   for xi in x
>     println(typeof(xi) <: T)
>   end
> end
>
> or some variation of that?
>
> On Sat, Oct 3, 2015 at 5:18 PM, <[email protected] <javascript:>> 
> wrote:
>
>> Is it possible to specify a variable number of parameter types in Julia, 
>> for instance something like
>>
>> function {T...}my_fun(x...)
>>   for i in 1:length(x)
>>     println(typeof(x[i]) <: T[i])
>>   end
>> end
>>
>> should print true ... times
>>
>> Thanks
>>
>
>

Reply via email to