title: Understanding foldLeft with Map instead of List
body: <p>I fould like to understand how <code>foldLeft</code> works for Maps. I do understand how it works if I have a List and call on it foldLeft with a zero-element and a function:</p>
  
  <pre><code>val list1 = List(1,2,3)
  list1.foldLeft(0)((a,b) =&gt; a + b)
  </code></pre>
  
  <p>Where I add the zero-element <code>0</code> with the first element of <code>list1</code> and then add the second element of <code>list1</code> and so on. So output becomes the new input and the first input is the zero-element.</p>
  
  <p>Now I got the code</p>
  
  <pre><code>val map1 = Map(1 -&gt; 2.0, 3 -&gt; 4.0, 5 -&gt; 6.2) withDefaultValue 0.0
  val map2 = Map(0 -&gt; 3.0, 3 -&gt; 7.0) withDefaultValue 0.0
  def myfct(terms: Map[Int, Double], term: (Int, Double)): Map[Int, Double] = ???
  
  map1.foldLeft(map2)(myfct)
  </code></pre>
  
  <ol>
  <li>So my first element here is a <code>Tuple2</code>, but since <code>map2</code> is a <code>Map</code> and not a <code>Tuple2</code>, what is the zero-element?</li>
  <li>When we had a <code>List</code>, namely <code>list1</code>, we always "took the next element in <code>list1</code>". What is the "next element in <code>map1</code>? Is it another pair of <code>map1</code>?</li>
  </ol>