Isn't this a manual `foldLeft`?