title: count occurrences of elements
body: <p>Counting all elements in a list is a one-liner in Haskell:</p>
  
  <pre><code>count xs = toList (fromListWith (+) [(x, 1) | x &lt;- xs])
  </code></pre>
  
  <p>Here is an example usage:</p>
  
  <pre><code>*Main&gt; count "haskell scala"
  [(' ',1),('a',3),('c',1),('e',1),('h',1),('k',1),('l',3),('s',2)]
  </code></pre>
  
  <p>Can this function be expressed so elegantly in Scala as well?</p>