For example, I have a type
abstract type Axis{a,A} end
How can I express in function type signature that I have a tuple of unknown numbers of Axis
with different type parameters? For instance,
julia> Tuple{Axis{a,A}, Axis{b,B}} where {a,b,A,B}
Tuple{Axis{a,A},Axis{b,B}} where B where A where b where a
julia> Tuple{Axis{a,A}, Axis{b,B}, Axis{c,C}} where {a,b,A,B,c,C}
Tuple{Axis{a,A},Axis{b,B},Axis{c,C}} where C where c where B where A where b where a
How can I express them in a general unified type? I tried as follows but failed.
julia> Tuple{Axis...}
ERROR: MethodError: no method matching iterate(::Type{Axis})
Closest candidates are:
iterate(::Core.SimpleVector) at essentials.jl:589
iterate(::Core.SimpleVector, ::Any) at essentials.jl:589
iterate(::ExponentialBackOff) at error.jl:171
...
Stacktrace:
[1] append_any(::Tuple{DataType}, ::Vararg{Any,N} where N) at ./essentials.jl:426
[2] top-level scope at none:0
In Python I can have
from typing import Tuple
# To specify a variable-length tuple of homogeneous type, use literal ellipsis, e.g.
Tuple[int, ...]
which is very handy. I want something similar in Julia.