title: Initial state in F# List.scan
body: <p>I have a simple problem and as I'm an F# newbie I can't seem to figure out how to do this. I have a list of tuples:</p>
  
  <pre><code>let l = [ (a, 2); (b, 3); (c, 2); (d, 6) ]
  </code></pre>
  
  <p>that I want to transform into this:</p>
  
  <pre><code>let r = [ (a, 2); (b, 5); (c, 7); (d, 13) ]
  </code></pre>
  
  <p>This simply adds the values of the second element in each tuple: <code>2 + 3 + 2 + 6</code>. The objects <code>a</code>, <code>b</code>, <code>c</code> and <code>d</code> are complex objects that I simply want to keep.</p>
  
  <p>I thought I should use <code>List.scan</code> for this. It takes a list, threads an accumulator through the computation and returns a list:</p>
  
  <pre><code>let r = l |&gt; List.scan (fun (_, s) (o, i) -&gt; (o, s + i)) (??, 0) |&gt; List.tail
  </code></pre>
  
  <p>But I don't know what to fill in for the question marks. I'm not interested in the initial state except for the <code>0</code>. And I don't want to specify some 'empty' instance of the first tuple element.</p>
  
  <p>Or is there a simpler way of doing this?</p>