modified iterator program to test fold