Note that if the type variable T does not appear in the argument signature
then the method won't be callable.
If you really want to make use of the variable parameters, your best bet I
think is to pass a tuple of args:
function f{T<:Tuple}(x::T)
for (i, param) in enumerate(T.parameters)
println(typeof(x[i]) <: param)
end
end
This (or some variant, I forget) can also make the types of the individual
xs available at compile time.
On Saturday, October 3, 2015 at 7:22:49 PM UTC-7, [email protected]
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
>