I have two arrays:
a = [[1,2],[3,4]];
b = [[5,6],[7,8]];
I want the resultant array to be their sum, i.e.,
c = [[6,8],[10,12]];
Would there be an elegant way to do so?
Note:
I currently know that to simply add a = [1,2] with b = [3,4] to get c = [4,6] I need to do
c = [a,b].transpose.map{|x| x.reduce(:+)};
but I'm not sure how to, if possible, extend this to my problem.