polish: update for loop into a fp style