perms=: ! A.&i. ] NB. permutations of n things Perms=: {~ perms@# NB. generalized version