title: Combining map and reduce
body: <p>I want to find a neat way to achieve the following:</p>
  
  <p>Pretend I have a list:</p>
  
  <pre><code>&gt; x = [1, 2, 3, 4, 5]
  </code></pre>
  
  <p>And a simple function that just adds two numbers:</p>
  
  <pre><code>&gt; def add(a, b)
        return a+b
  </code></pre>
  
  <p>I can reduce the list <code>x</code> directly with:</p>
  
  <pre><code>&gt; sum = reduce(add, x)
  &gt; print(sum)
  15
  </code></pre>
  
  <p>Which gives me the sum just fine. But I would like to know the value after <strong>each application of add</strong>. So using a function similar to reduce, I'd like to get back the following array:</p>
  
  <pre><code>&gt; result = SOME_FUNCTION(add, x)
  &gt; print(result)
  [3, 6, 10, 15]
  </code></pre>
  
  <p>Does anybody have a cool way of achieving that. I have a strong preference for using some form of itertools solution if possible :)</p>