title: Cumulative sum of int list
body: <p>I implemented the following functions for cumulative sum:</p>
  
  <pre><code>fun cumsum_reverse (xs: int list) = 
    if null xs then [0]
    else
      let val tl_cumsum = cumsum_reverse (tl xs)
      in
        hd xs + hd tl_cumsum :: tl_cumsum
      end
  
  fun reverse (first: int list, second: int list) =
    if null first
    then
      second
    else
      reverse (tl first, hd first :: second)
  
  fun cumsum (xs: int list) = 
    tl(reverse(cumsum_reverse(reverse(xs, [])), []))
  </code></pre>
  
  <p>Test case:</p>
  
  <pre><code>val test = cumsum[1,4,20] = [1,5,25]
  </code></pre>
  
  <p>Is there any way to implement this using one function only?</p>