title: Iterate over scala list
body: <p>I have a list of strings in scala template of play framework.<br/>
   I want to iterate over half of list at one time and then the other half of list on the second time. <br/>
  I am not sure how to write efficient iterator for this.</p>
  
  <p>I have tried<br/>
   <code>@for(i &lt;- 0 until list.length/2 ) 
      {list(i) }</code>
  <br/> 
  and then for second loop<br/></p>
  
  <pre><code>@for(i &lt;- list.length/2+1 until list.length ) 
   { list(i) } 
  </code></pre>
  
  <p><br/>
  This works but complexity becomes high. </p>
  
  <p>Then later I did<br/></p>
  
  <pre><code>  @defining(list.size) { size =&gt; 
      @for(i &lt;- 0 until size/2) 
      {list(i) }
    }
  </code></pre>
  
  <p><br/>
  Now it seems to work fine.</p>