We can use "myTuple.0
" to get the first member of a tuple. Is there a similar way for the last member? The members are static numbers (AIUI), so "myTuple.(count - 1)
" can't work.
I'm interested because of variadic generics. We can use a function family to peel off the front members, but that's inherently O(n)
, and I prefer something O(1)
. Hopefully, we only need to manipulate tuples by pushing/popping off their very first or very last member.
Is this something that needs to be proposed and added? What name could we even use without a potential conflict? Don't refer to it with "myTuple.last
," but with a free function like "#tupleLast(myTuple)
" instead? If that, how could we make that access mutable?