title: How to merge a sequence of arrays in scala
body: <p>I have a value of type <code>Seq[Array[Int]]</code> and I want to end up with a single <code>Array[Int]</code>.  I thought foldLeft would work, but surprisingly it doesn't: </p>
  
  <pre><code>scala&gt; val arr1 = Array(1,2,3)
  arr1: Array[Int] = Array(1, 2, 3)
  
  scala&gt; val arr2 = Array(4,5,6)
  arr2: Array[Int] = Array(4, 5, 6)
  
  scala&gt; val seq = Seq( arr1, arr1 )
  seq: Seq[Array[Int]] = List(Array(1, 2, 3), Array(1, 2, 3))
  
  scala&gt; seq.foldLeft ( Array.empty )( (x,y) =&gt; x ++ y )
  &lt;console&gt;:17: error: value ++ is not a member of Array[Nothing]
         seq.foldLeft ( Array.empty )( (x,y) =&gt; x ++ y )
                                                  ^
  </code></pre>
  
  <p>That error doesn't seem like the entire truth though because I can do this:</p>
  
  <pre><code>scala&gt; Array.empty
  res22: Array[Nothing] = Array()
  
  scala&gt; Array.empty ++ arr1 ++ arr2
  res23: Array[Int] = Array(1, 2, 3, 4, 5, 6)
  </code></pre>
  
  <p>What gives?</p>