title: Using nested reduce in Swift
body: <p>I have an array which contains an arrays of <code>Double</code>, like in the screenshot: </p>
  
  <p><a href="https://i.stack.imgur.com/GmXn7.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/GmXn7.png" alt="enter image description here"></a></p>
  
  <p>My goal is to get the sum of the multiplication of the <code>Double</code> 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.</p>
  
  <p>I want to use <code>reduce</code>, <code>flatMap</code> ? or any elegant solution.</p>
  
  <p>What I have tried ?</p>
  
  <pre><code>totalCombinations.reduce(0.0) { $0 + ($1[0]*$1[1]*$1[2])  }
  </code></pre>
  
  <p>but this work only when I know the size of the arrays that contains the doubles. </p>