…but you really mostly shouldn’t be doing much computation with tuples in the first place,…
I was wondering if someone could elaborate on why? Is it because tuples are immutable and you may need to construct a new tuple every time a value needs to be updated?
One would have to implement all mathematically sensible computations for tuples. For example, this is not implemented:
julia> x = (1,2)
(1, 2)
julia> 2*x
ERROR: MethodError: no method matching *(::Int64, ::Tuple{Int64,Int64})
The solution to such implementation exists and is the StaticArrays package that everyone is mentioning. StaticArrays are the tuples for which the computations can be performed:
julia> using StaticArrays
julia> x = SVector{2,Float64}(1,2)
2-element SArray{Tuple{2},Float64,1,2} with indices SOneTo(2):
1.0
2.0
julia> 2*x
2-element SArray{Tuple{2},Float64,1,2} with indices SOneTo(2):
2.0
4.0
Sure, but multiplication by a scalar does not, summing tuples does not, multiplication by a matrix does not etc. Probably if it was chosen to put tuples as center type for computations those should have been implemented as well.