Oh, I didn't know about that either. This is also what I'm looking for.
When I looked through tuple.jl for inspiration and through the
documentation I just didn't see these (probably my fault for not looking
carefully enough).
Bill.
On 10 August 2016 at 16:53, Pablo Zubieta
And just to throw out another option, you might also consider
((a[i] + b[i] for i = 1:N)...)
Pablo.
map is incredibly slow and not at all useful for something like addition.
However the first example looks like what I am looking for, depending on
how it is implemented.
Thanks.
Bill.
On 10 August 2016 at 16:45, Pablo Zubieta wrote:
> Does something like this seems good
Does something like this seems good enough?
Base.:+{N}(a::NTuple{N}, b::NTuple{N}) = ntuple(i -> a[i] + b[i], N)
there is also
map(+, a, b)
where `a`, and `b` are the tuples you want to sum elementwise.
There is a chance that eventually one will be able to also use broadcast or
elementwise