<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  </head>
  <body>
    <br>
    <blockquote type="cite" cite="mid:170769614.9486186.1652943159193.JavaMail.zimbra@u-pem.fr">
      <div style="font-family: arial, helvetica, sans-serif; font-size:
        12pt; color: #000000">
        <div data-marker="__QUOTED_TEXT__">
          <div>We may want to extract sub-parts of the array /
            collections by example, and i would prefer to have the same
            semantics and a similar syntax.<br data-mce-bogus="1">
          </div>
        </div>
      </div>
    </blockquote>
    <br>
    This is pretty vague, so I'll have to guess about what you might
    mean.  <br>
    <br>
    Maybe you mean: "I want to match a list if it contains the a
    subsequence that matches this sequence of patterns", something like:<br>
    <br>
        [ ... p1, p2, ... ]<br>
    <br>
    There is surely room to have APIs that query lists like this, but I
    think this is way out of scope for a pattern matching feature the
    language.  Pattern matching is about _destructuring_. 
    (Destructuring can be conditional.)   An array is a linear sequence
    of elments; it can be destructured by a linear sequence of
    patterns.  <br>
    <br>
    Maybe you mean: "I want to decompose a list into the head element
    and a tail list".  <br>
    <br>
    In Haskell, we iterate a list by recursion:<br>
    <br>
        len :: [a] -> Int<br>
        len [] = 0<br>
        len x:xs = 1 + len xs<br>
    <br>
    But again, this is *mere destructuring*, because the cons operator
    (:) is the linguistic primitive for aggregation, and [ ... ] lists
    are just sugar over cons.  So matching to `x:xs` is again
    destructuring.  We could try to apply this to Java, but it gets very
    clunky (inefficient, no tail recursion, yada yada) because our lists
    are *built differently*.  Further further, arrays are another step
    removed from lists even.  <br>
    <br>
    Or maybe you mean something else; if so, please share!<br>
    <br>
  </body>
</html>