title: Scala functional programming with vectors
body: <p>I am new to Scala programming and have some difficulty with functional programming and immutable collections. I am trying to port my numeric code from C++ to Scala.</p>
  
  <p>A lot of time I have code operating on small vector like this:</p>
  
  <pre><code>double ytmp[6];
  
  for (int i=0; i&lt;6; i++) {
      ytmp[i] = y[i] + h*(a41*dydx[i] + a42*k2[i] + a43*k3[i]);
  }
  </code></pre>
  
  <p>How do I write something like this in efficient Scala? I thought about using simple lists in the beginning, but have problems with the immutable types, so I can't just create a empty list ytmp and modify it later like I am used to i C++. 
  Thanks for the help</p>