is this a more general task, or do you only ever have exactly four items to arrange that way?
an easier way of doing what you did would be take any solution, the 0 2 1 3&{ of it, the |. of both, and apply (i.4) |."1 to all four. That sould get you all possible 16 solutions maybe someone else knows of a better way to achieve this? Am 25.05.20 um 13:47 schrieb Brian Schott:
I want all permutations of i. 4 for which 0 and 3 cannot be adjacent, nor can 1 and 2. My idea is to create a as follows to describe my situation. ]a =. 0 1 1 0,:i. 4 0 1 1 0 0 1 2 3 Next I created b and rotations on b to list the possibilities I can think of. So I can think of 6 permutations. Are there more and is there a better way to generate the real qualifying permutations? ]b =. 0 1 3 2 ,:1 0 2 3 0 1 3 2 1 0 2 3 1|."1 b 1 3 2 0 0 2 3 1 _1|."1 b 2 0 1 3 3 1 0 2
-- ---------------------- mail written using NEO neo-layout.org ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm