Partial sum implementation

These should all be returning `std::pair<I, O>{begin, result}`.