On Mon, May 25, 2015 at 3:47 PM, andrew cooke <[email protected]> wrote: > thanks!
I think there's also discussions about making certain methods like `length` or iteration works on the tuple types but I'm not sure if there's a decision yet. > > On Sunday, 24 May 2015 16:32:43 UTC-3, Yichao Yu wrote: >> >> On Sun, May 24, 2015 at 3:13 PM, andrew cooke <[email protected]> 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 >> >
