### 20.1.11 Accumulating terms

The accumulate_head_tail command replaces the first terms of a list by their sum and the last terms of a list by their sum.

- accumulate_head_tail takes three arguments:
  - L, a list of numbers.
  - n, the number of initial terms to add.
  - m, the number of end terms to add.
- accumulate_head_tail(L,n,m) returns the list with the n initial terms and m end terms replaced by their sums.

#### Example

accumulate_head_tail([1,2,3,4,5,6,7,8,9,10],3,4)

[6,4,5,6,34] |  |  |  |  |  |  |  |  |  |