separate out cumulativeIterator from applyCumulatively