title: Catch the excepcion in Ocaml
body: <p>I have 2 problems.</p>
  
  <p>First problem:</p>
  
  <p>I do</p>
  
  <pre><code>let num1 = int_of_string (get_2 car1) in
  </code></pre>
  
  <p>Where car1 is a pair (string,string)</p>
  
  <p>but int_of_string Raise Failure "int_of_string" if the given string is not a valid representation of an integer.</p>
  
  <p>I whant to do something like:</p>
  
  <pre><code>try {
      let num1 = int_of_string (get_2 car1) in
  }
  catch Failure "int_of_string" {
      let num1 = 0;
  }
  </code></pre>
  
  <p>Second problem:</p>
  
  <p>In another function i do:</p>
  
  <pre><code>let aa = List.map(fun x -&gt; int_of_string x) right in
  </code></pre>
  
  <p>where right is a list os string, mostly they are numbers, but some of its elements can be strings like: "SID", "SMAX" and these break the function, releasing me: </p>
  
  <pre><code>Fatal error: exception Failure("int_of_string")
  </code></pre>
  
  <p><strong>I CAN NOT USE RECURSION AND PATTERN MATCHING, i have to do with List function.</strong></p>