On Sun, May 24, 2015 at 3:13 PM, andrew cooke <and...@acooke.org> wrote:
>
> Is there a simple way, in 0.4, given the type of a tuple, to know how many
> entries it has?
>
> When types of tuples were themselves tuples you could just use length, but
> that no longer works.

```
julia> typeof((1, 2, 3))
Tuple{Int64,Int64,Int64}

julia> typeof((1, 2, 3)).parameters
svec(Int64,Int64,Int64)

julia> length(typeof((1, 2, 3)).parameters)
3
```

works for other parametrized types as well.

>
> (I don't have a desperately important use case, it's just the hacky way I
> wrote some tests in some code I am bringing up-to-date)
>
> Thanks,
> Andrew
>

Reply via email to