Common functional iterator patterns.