title: Pattern matching lists of certain size or greater/less
body: <p>Is there a way to specify a pattern that matches a List with a size greater (or less) or equal a certain value in Scala?</p>
  
  <p>For example, if I want to apply the same action to all lists of size 3 or less:</p>
  
  <pre><code>list match {
      case Nil =&gt; op(list) 
      case x :: Nil =&gt; op(list)
      case x :: y :: Nil =&gt; op(list)
      case x :: y :: z :: Nil =&gt; op(list)
      case x :: tail =&gt; other(list)
  } 
  </code></pre>
  
  <p>Is there a way to reduce this to two cases?</p>