simplify each_permutation control flow and each_combination indexing tests