title: what's a proper or simple way for this control flow instead of try catch?
body: <p>I cannot find any simple (compared to the <code>try catch</code> method, which is rather straightforward) way to do this:</p>
  <pre><code>try
      Some (line.Split delimiter |&gt; Array.map Int32.Parse)
  with
      |_ -&gt; None
  </code></pre>
  <p>A bad (call <code>Parse</code> twice) approach is like this:</p>
  <pre><code>let array = line.Split delimiter
  let parseSucceed =
      array |&gt; Array.exist (Int32.TryParse &gt;&gt; fst &gt;&gt; not)
            |&gt; not
  if parseSucceed then Some (array |&gt; Array.map Int32.Parse) else None
  </code></pre>
  <p>Is there any standard way of doing such tasks? Do I have to write up a recursive function to handle this?</p>
  <p>What if the input is not an array but a stream/sequence?</p>
  <h3>Update:</h3>
  <p>@Daniel's method is great.</p>
  <pre><code>module Seq =
      let tryCatch myFun (x: seq&lt;_&gt;) =
          let rec loop acc (e: IEnumerator&lt;_&gt;) =
              if e.MoveNext() then
                  match myFun e.Current with
                  | Some v -&gt; loop (v::acc) e
                  | None   -&gt; (false, acc |&gt; List.rev |&gt; List.toSeq)
              else
                  (true, acc |&gt; List.rev |&gt; List.toSeq)
          use e = x.GetEnumerator()
          loop [] e
  
  let parse x =
      printf &quot;%d &quot; x // log when the function is called.
      if x &gt; 3 then None else Some x
  
  let tt myFun x =
      let y = Seq.tryCatch myFun x
      if fst y then
          printfn &quot;yes %A&quot; (y |&gt; snd |&gt; Seq.toArray)
      else
          printfn &quot;no %A&quot; (y |&gt; snd |&gt; Seq.toArray)
  
  tt parse [| 0;2;1;2;4;1;2 |]
  tt parse [| 0;2;1;2 |]
  
  &gt; 
  0 2 1 2 4 no [|0; 2; 1; 2|]  // parse is called minimum number of times
  0 2 1 2 yes [|0; 2; 1; 2|]
  </code></pre>