Missing parameter type error by calling toSet? <p>Trying to generate, from a list of chars, a list of unique chars mapped to their frequency - e.g. something like:</p> <pre><code>List('a','b','a') -&gt; List(('a',2), ('b',1)) </code></pre> <p>So, just mucking around in the console, this works:</p> <pre><code>val l = List('a', 'b', 'c', 'b', 'c', 'a') val s = l.toSet s.map(i =&gt; (i, l.filter(x =&gt; x == i).size)) </code></pre> <p>but, shortening by just combining the last 2 lines doesn't?</p> <pre><code>l.toSet.map(i =&gt; (i, l.filter(x =&gt; x == i).size)) </code></pre> <p>gives the error "missing parameter type".</p> <p>Can someone explain why Scala complains about this syntax?</p>