title: Match single element in list of lists
body: <p>If I have a list of the form <strong>List[Any]</strong> like this one</p>
  
  <blockquote>
    <p>val list = List(List(1, 1), 2, List(3, List(5, 8)))</p>
  </blockquote>
  
  <p>how do I then write a match statement that distinguishes between</p>
  
  <ol>
  <li>Single element of any non list type (i.e. <strong>2</strong> from above)</li>
  <li>Elements that are lists (i.e. <strong>List(1,1)</strong> and <strong>List(3, List(5, 8)</strong> from above)</li>
  </ol>
  
  <p>or in pseudo scala</p>
  
  <pre><code>list match {
    case x:"single non-list element" =&gt; // do something with single element x
    case y:"where y is a list"       =&gt; // do something with list y
  }
  </code></pre>
  
  <p>the usual <strong>head::tails</strong> matching does not work as <strong>head</strong> can be of type <strong>Any</strong> which includes other lists.</p>