ICE: Building an array from an fcurve

Suppose you have an animated scalar value, and you want to store its values as you play through a simulation. And suppose you also want to keep a running total of all the values up to the current frame.

My first try used two arrays: one to store the values at each step through the simulation, and one to hold the running total.

Calculating the array sum at every step seems wasteful. So, here’s my second try at keeping a running total of the values from the fcurve. I use just one attribute and one array. The attribute was necessary because if I plugged Pop from Array directly into Add, I got nothing.