I have an array which contains an arrays of Double, like in the screenshot:
My goal is to get the sum of the multiplication of the Double elements of each array. It means, I want to multiply all elements of each array then, in my case, I will have 3 values so I get the sum of them.
I want to use reduce, flatMap ? or any elegant solution.
What I have tried ?
totalCombinations.reduce(0.0) { $0 + ($1[0]*$1[1]*$1[2]) }
but this work only when I know the size of the arrays that contains the doubles.
