Is your feature request related to a problem? Please describe.
We should change rename the current sum function to be called total and create a new sum function that takes four parameters such as start index, end index, index variable, function.
This new sum function could have optimizations such as the sum of [0,n] or [1,n] is known to be n * (n - 1)/2.