title: Scala map and/or groupby functions
body: <p>I am new to Scala and I am trying to figure out some scala syntax.</p>
  
  <p>So I have a list of strings.  </p>
  
  <pre><code>wordList: List[String] = List("this", "is", "a", "test")
  </code></pre>
  
  <p>I have a function that returns a list of pairs that contains consonants and vowels counts per word:</p>
  
  <pre><code>def countFunction(words: List[String]): List[(String, Int)]
  </code></pre>
  
  <p>So, for example:</p>
  
  <pre><code>countFunction(List("test")) =&gt; List(('Consonants', 3), ('Vowels', 1))
  </code></pre>
  
  <p>I now want to take a list of words and group them by count signatures:</p>
  
  <pre><code>def mapFunction(words: List[String]): Map[List[(String, Int)], List[String]]
  
  //using wordList from above
  mapFunction(wordList) =&gt; List(('Consonants', 3), ('Vowels', 1)) -&gt; Seq("this", "test")
                           List(('Consonants', 1), ('Vowels', 1)) -&gt; Seq("is")
                           List(('Consonants', 0), ('Vowels', 1)) -&gt; Seq("a")
  </code></pre>
  
  <p>I'm thinking I need to use GroupBy to do this:</p>
  
  <pre><code>def mapFunction(words: List[String]): Map[List[(String, Int)], List[String]] = { 
      words.groupBy(F: (A) =&gt; K)
  }
  </code></pre>
  
  <p>I've read the scala api for Map.GroupBy and see that F represents discriminator function and K is the type of keys you want returned. So I tried this:</p>
  
  <pre><code>    words.groupBy(countFunction =&gt; List[(String, Int)]
  </code></pre>
  
  <p>However, scala doesn't like this syntax. I tried looking up some examples for groupBy and nothing seems to help me with my use case. Any ideas?</p>