Expands lambda into a loop.