static L allPermutations_arrays(L l) {
int n = factorial(l(l));
LL out = new L(n);
allPermutations_impl(cloneList(l), l(l), out);
ret out;
}
static void allPermutations_impl(L l, int n, L out) {
if (n <= 1) {
ping();
out.add((A) toObjectArray(l));
} else for(int i = 0; i < n; i++) {
allPermutations_impl(l, n-1, out);
swapElements(l, n % 2 == 0 ? i : 0, n-1);
}
}