title: Duplicate values in Ocaml
body: <p>How do you delete repeated values (i.e. duplicates) from a queue in Ocaml? </p>
  
  <p>For example, suppose this is a queue (although it is presented in the form of a list):</p>
  
  <pre><code>     [1; 1; 2; 3; 4; 7; 7; 8; 8; 8]
  </code></pre>
  
  <p>Then, after applying this function to the queue, we would get:</p>
  
  <pre><code>     [1; 2; 3; 4; 7; 8]
  </code></pre>
  
  <p>Implementation in the case of lists:</p>
  
  <pre><code>     let rec deleteDuplicate l = 
          match l with 
           | []                -&gt; [] 
           | x :: []          -&gt; x :: [] 
           | x :: y :: rest -&gt; 
                 if x = y then deleteDuplicate (y :: rest) 
                 else x :: deleteDuplicate (y :: rest) 
  </code></pre>