build loops whose index types match the body function's arguments