title: Keeping a count of the number of recursive calls in Ocaml
body: <p>I'm new to Ocaml. The problem I'm having is keeping track of the number of recursive calls in a function. </p>
  
  <p>For instance, I wrote a following function:</p>
  
  <pre><code>    let rec someFunction n = 
      let digi = someOtherFunction n in
      match digi with
      | x when x &gt; 123 -&gt; someFunction digi 
      | x -&gt; [want to output # of recursive calls] ;;
  </code></pre>
  
  <p>How do I go about doing this? I tried creating a variable but it just keeps resetting to its initial value if I have it in someFunction. What I basically want to do is something like this:</p>
  
  <pre><code>     while ( x &gt; 123) {
       count++;
       someFunction(x);
       }
  
       return count;
  </code></pre>
  
  <p>Forgive me if this is something extremely trivial. </p>