title: Reduce left-fold in R
body: <p>I am using the higher-order function to apply a function to every element in a vector and return the result as a scalar value.</p>
  
  <p>Suppose I have:</p>
  
  <pre><code>v = c(0, 1, 2, 3, 4, 5, 6, 7, 8)
  </code></pre>
  
  <p>I want to compute the sum of all these integers centered 5 integers to the left:</p>
  
  <p>SUM(i-5) for i in v:</p>
  
  <pre><code>Reduce(function(i) sum(i-5), v, 0)
  </code></pre>
  
  <p>I get the following error: <code>Error in f(init, x[[i]]) : unused argument(s) (x[[i]])</code></p>
  
  <p>What is going wrong with my lambda function?</p>
  
  <p>Thanks!</p>