`reduce` will be a better fit here.