complete ex7_1 with a stateless iterator