title: Fill immutable map with for loop upon creation
body: <p>I have this map that looks like this:</p>
  
  <pre><code>val fields: Map[(Int, Int), Field]
  </code></pre>
  
  <p>and I thought about doing something like:</p>
  
  <pre><code>val fields: Map[(Int, Int), Field] = 
  Map(
     for(a &lt;- 0 to 10)
     {
       (0, a) -&gt; new Field(this, 0, a)
     }
  )
  </code></pre>
  
  <p>instead of a long copy/paste list like:</p>
  
  <pre><code>  (0, 0) -&gt; new Field(this, 0, 0),
    (1, 0) -&gt; new Field(this, 1, 0),
    (2, 0) -&gt; new Field(this, 2, 0),
    (3, 0) -&gt; new Field(this, 3, 0),
    (4, 0) -&gt; new Field(this, 4, 0),
    (5, 0) -&gt; new Field(this, 5, 0),
    (6, 0) -&gt; new Field(this, 6, 0),
    (7, 0) -&gt; new Field(this, 7, 0),
    (8, 0) -&gt; new Field(this, 8, 0),
  
    (0, 1) -&gt; new Field(this, 0, 1), ...
  </code></pre>
  
  <p>But I get </p>
  
  <blockquote>
    <p>Type mismatch, expected: (NotInferedA, NotInferedB), actual: Unit</p>
  </blockquote>
  
  <p>Why is this and how can I overcome this?</p>