title: Extent of `as` in pattern matching
body: <p>Given a function that removes consecutive duplicates from a list</p>
  <pre><code>let rec compress l =
    match l with
    | [] -&gt; []
    | [x] -&gt; [x]
    | x :: (y :: _ as t) -&gt; if x = y then compress t else x :: compress t;;
  </code></pre>
  <p>yields the correct result</p>
  <pre><code>compress [&quot;a&quot;; &quot;a&quot;;&quot;b&quot;;&quot;c&quot;;&quot;c&quot;] ;;
  - : string list = [&quot;a&quot;; &quot;b&quot;; &quot;c&quot;]
  </code></pre>
  <p>but if instead of <code>x :: (y :: _ as t)</code> I change to <code>x :: (y :: t)</code>, then I get the incorrect result</p>
  <pre><code>compress [&quot;a&quot;; &quot;a&quot;;&quot;b&quot;;&quot;c&quot;;&quot;c&quot;] ;;
  - : string list = [&quot;b&quot;; &quot;c&quot;]
  </code></pre>
  <hr />
  <p>What is going on here ? I can't wrap my head around as to how the declaration <code>_ as t</code> changes the output of the function. Intuitively, I would think they are equivalent statements (<code>:: _ as t</code> and <code>:: t</code>), but seemingly they are not.</p>
  <p>Could someone elaborate ?</p>