title: Scala - iterators and takeWhile
body: <p>I am running the following piece of code:</p>
  
  <pre><code> val it = List(1,1,1,2,2,3,3).iterator.buffered
   val compare = it.head
  it.takeWhile(_ == compare).toList
  </code></pre>
  
  <p>and it returns (1,1,1). However, if I run this as:</p>
  
  <pre><code>val it = List(1,1,1,2,2,3,3).iterator.buffered
  it.takeWhile(_ == it.head).toList
  </code></pre>
  
  <p>I am getting (1,1). Why is this the case? Isn't <code>head</code> evaluated upon calling <code>takeWhile</code> and the result should be the same? </p>