title: Best way to condense a list of option type down to only elements that are not none?
body: <p>I'm unexpectedly having a bit of trouble with going from a list of 'a option down to a list containing only the elements that are Some.</p>
  
  <p>My initial attempt was:</p>
  
  <pre><code>    let ga = List.filter (fun xx -&gt;
          match xx with
          | Some(g) -&gt; true
          | None -&gt; false) gao 
  </code></pre>
  
  <p>But of course, this result type is still 'a option list. I don't know how to use List.map to condense this, because you have to handle all cases in a match statement. I have an ugly solution, but I'm wondering if there is something better.</p>
  
  <p>Ugly:</p>
  
  <pre><code>    let rec gOptRemove gdec gacc = 
          match gdec with 
          | head :: tail -&gt; 
              match head with 
              | Some(a) -&gt; gOptRemove tail (a :: gacc)
              | None -&gt; gOptRemove tail gacc
          | [] -&gt; gacc
  </code></pre>
  
  <p>I would prefer to find a non-recursive solution or find out what the standard way is for this kind of thing.</p>