title: Record methods in F#
body: <p>I have written a simple example for my scenario. I create a record type <code>Switch</code></p>
  
  <pre><code>type State =
      | On
      | Off
      with
          member this.flip =
              match this with
              | On -&gt; Off
              | Off -&gt; On
  
  type Switch = { State : State }
  </code></pre>
  
  <p>and then I write a function that creates a copy of the record with one element changed</p>
  
  <pre><code>let flip switch = { switch with State = switch.State.flip } 
  </code></pre>
  
  <p>To <code>flip</code> many successive times I write</p>
  
  <pre><code>let flipMany times switch =
      [1 .. times]
      |&gt; List.fold (fun (sw : Switch) _ -&gt; flip sw) switch
  </code></pre>
  
  <p>If I want put these two functions on the record as methods, I write instead</p>
  
  <pre><code>type Switch =
      { State : State }
      member this.flip = 
          { this with State = this.State.flip }
      member this.flipMany times =
          [1 .. times]
          |&gt; List.fold (fun (sw : Switch) _ -&gt; sw.flip) this
  </code></pre>
  
  <p>Is there anything wrong with doing this? Is it equally efficient? It feels a bit uncomfortable calling the function <code>sw.flip</code> on a different object every single time.</p>
  
  <p>Edit: this is just a simple example in order to explain my question. My question is on how the function <code>flipMany</code> compares with the <code>flipMany</code> method on the record. The implementation might be naive, but it is the same in both of cases.</p>