title: How does F# implement let rec?
body: <p>I am wondering how F# implements <code>let rec</code>, and I couldn't find an answer. As a preface, I'll address how Scheme implements <code>letrec</code>:</p>
  
  <ol>
  <li>In Scheme, <code>let</code> is just syntactics sugar for a definition of a lambda and applying it: </li>
  </ol>
  
  <p><code>(let ((x 1)) (+ x 2))</code></p>
  
  <p>is transformed to</p>
  
  <p><code>((lambda (x) (+ x 2)) 1)</code> </p>
  
  <p>(in each case the expression is evaluated to <code>3</code>).</p>
  
  <ol start="2">
  <li><code>letrec</code> is also syntactic sugar, but <code>#f</code> is passed as initial argument to the lambda's parameters, and <code>set!</code> expressions are injected before the <code>letrec</code> body, like in this transformation:</li>
  </ol>
  
  <p><code>(letrec ((x 1)) (+ x 2)) =&gt; ((lambda (x) (begin (set! x 1) (+ x 2))) #f)</code>.</p>
  
  <p>Considering that F# doesn't have an equivalent operator to Scheme's <code>set!</code>, how does it implement <code>let rec</code>? Does it declare the function's parameters as <code>mutable</code>, and then mutate them in the function's body?</p>