Moving sums
x msum y msum[x;y]
Where
x is a positive int atomy is a numeric listreturns the x-item moving sums of y, with nulls replaced by zero. The first x
items of the result are the sums of the terms so far, and thereafter the result is the moving sum.
q)3 msum 1 2 3 5 7 11
1 3 6 10 15 23
q)3 msum 0N 2 3 5 0N 11 / nulls treated as zero
0 2 5 10 8 16
msum is a uniform function.