title: Why does ocaml need both "let" and "let rec"?
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/900585/why-are-functions-in-ocaml-f-not-recursive-by-default">Why are functions in Ocaml/F# not recursive by default?</a>  </p>
  </blockquote>
  
  
  
  <p>OCaml uses <code>let</code> to define a new function, or <code>let rec</code> to define a function that is recursive. Why does it need both of these - couldn't we just use <code>let</code> for everything?</p>
  
  <p>For example, to define a non-recursive successor function and recursive factorial in OCaml (actually, in the OCaml interpreter) I might write</p>
  
  <pre><code>let succ n = n + 1;;
  
  let rec fact n =
      if n = 0 then 1 else n * fact (n-1);;
  </code></pre>
  
  <p>Whereas in Haskell (GHCI) I can write</p>
  
  <pre><code>let succ n = n + 1
  
  let fact n =
      if n == 0 then 1 else n * fact (n-1)
  </code></pre>
  
  <p>Why does OCaml distinguish between <code>let</code> and <code>let rec</code>? Is it a performance issue, or something more subtle?</p>