Use elem instead of ad-hoc lambda in permutations test.