Previous Up Next

7.1.10  Accumulating terms: accumulate_head_tail

The first terms and last terms of a list can be accumulated by replacing them with their sum using the accumulate_head_tail command. This command takes the list, the number of initial terms to sum, and the number of end terms to add, and returns the list with the initial terms and end terms replaced by their sums. For example, the command


will return


Previous Up Next