Partial sum implementation

For future reference, you can just return `{begin, result}`. Don't bother changing it though.