Previous Up Next

9.1.11  Accumulating terms: accumulate_head_tail

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.


Example.
Input:

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

Output:

[6,4,5,6,34]

Previous Up Next