I believe the current way to do this is:

julia> t(x::Tuple{Vararg{Int}}) = sum(x)
t (generic function with 1 method)

julia> t((1,1))
2

julia> t((1,1,1))
3

julia> t((1,1,1,1))
4

Though I recall there being an open issue or two on syntax to make this
nicer. (something like `t(x::{Int...})` )

-Jacob


On Sun, Oct 11, 2015 at 12:08 PM, Jerry Xiong <xiongji...@gmail.com> wrote:

> For example, in Julia 0.3, I can use below function definition:
>
> julia> f(::(Int...))="This is an Int tuple."
> julia> f((1,2))
> "This is an Int tuple."
> julia> f((1,2,3))
> "This is an Int tuple."
>
> How to define a function with unlimited tuple length in Julia 0.4?
>

Reply via email to