title: Example of the Scala aggregate function
body: <p>I have been looking and I cannot find an example or discussion of the <code>aggregate</code> function in Scala that I can understand. It seems pretty powerful.</p>
  
  <p>Can this function be used to reduce the values of tuples to make a multimap-type collection? For example:</p>
  
  <pre><code>val list = Seq(("one", "i"), ("two", "2"), ("two", "ii"), ("one", "1"), ("four", "iv"))
  </code></pre>
  
  <p>After applying aggregate:</p>
  
  <pre><code>Seq(("one" -&gt; Seq("i","1")), ("two" -&gt; Seq("2", "ii")), ("four" -&gt; Seq("iv"))
  </code></pre>
  
  <p>Also, can you give example of parameters <code>z</code>, <code>segop</code>, and <code>combop</code>? I'm unclear on what these parameters do.</p>