El domingo, 24 de julio de 2016, 7:52:47 (UTC-4), jw3126 escribió:
>
> I need a function, which accepts an arbitrary tuple type and returns the
> types of the components of the tuple. For example
> ```
> f(Tuple{Int64, Float64}) --> (Int64, Float64)
> f(Tuple{Int64, MyType, Float32}) --> (Int64, MyType, Float32)
> f(NTuple{3}) --> (Any, Any, Any)
> f(Tuple) --> Some error since
> length is unknown
> ```
>
This information is stored inside the tuple type:
julia> t = Tuple{Int64, Float64}
Tuple{Int64,Float64}
julia> t.parameters
svec(Int64,Float64)
julia> t.parameters[1]
Int64
>
> How to accomplish this?
>