title: Understanding foldLeft in Scala
body: <p>Please help me understand the below statement.  I couldn't understand how foldLeft works here:</p>
  
  <pre><code>scala&gt; l1
  res71: List[Double] = List(1.0, 1.0, 1.0)
  
  scala&gt; l2
  res72: List[Double] = List(1.5, 0.0)
  
  scala&gt; l1.foldLeft(l2) { (a,b) =&gt; (b + a.head) :: a}
  res73: List[Double] = List(4.5, 3.5, 2.5, 1.5, 0.0)
  </code></pre>