title: Haskell: Efficient accumulator
body: <p>What is the best way to map across a list, using the result of each map as you go along, when your result is of a different type to the list.</p>
  
  <p>for example </p>
  
  <pre><code>f :: Int -&gt; Int -&gt; String -&gt; String
  
  l = [1,2,3,4]
  </code></pre>
  
  <p>I would like to have something that walks along the list l and does:</p>
  
  <p><code>f 1 2 [] = result1 =&gt; f 2 3 result1 = result2 =&gt; f 3 4 result3  ==&gt; return result3.</code></p>
  
  <p>I can sort of get this to work with a an accumulator, but it seems rather cumbersome. Is there a standard way to do this... or is this something for Monads??</p>
  
  <p>Thanks!</p>
  
  <p>NB the function above is just for illustration.</p>