Hi All, I came up with this program to generate pairs of indices to select all unique pairs from a list. Is there a built in J way to do this? I looked at C. and A. but could not see how to achieve the below.
Thanks, Matthew. pairi =: ( ( ] #~ [: (~:/)"1 ] ) [: ~. [: /:~"1 (]#[:i.]) ,."0 *:$i.) NB. 2 item list has one pair with indices 0 and 1 pairi 2 0 1 NB. 3 item list has 3 pairs with these indices: pairi 3 0 1 0 2 1 2 NB. 4 item list has 6 pairs with these indices: pairi 4 0 1 0 2 0 3 1 2 1 3 2 3 ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
