title: Function that removes an element from a sequence
body: <p>I made a function to remove the n-th element from a sequence. Here's the code</p>
  
  <pre><code>let rec remove_at i s () =
    if i &lt; 0 then
      invalid_arg "Seq.remove"
    else
      match s () with
      | Nil -&gt;  invalid_arg "Seq.remove_at"
      | Cons(e, s) -&gt; if i = 0 then s () else Cons(e, remove_at (i - 1) s)
  </code></pre>
  
  <p>But when I test for example <code>remove_at 0 (of_list[])</code>, it doesn't raise an exception and I don't know why.</p>