Two of my favorite constructs are 4$.$. and each. Therefore: (#~</"1)4$.$.5 5$1
or: ;(i.,.]) each ;/i.5 The second is more efficient, despite boxes. Ben ________________________________________ From: [email protected] [[email protected]] on behalf of 'Jon Hough' via Programming [[email protected]] Sent: Friday, December 18, 2015 13:58 To: Programming Forum Subject: [Jprogramming] Getting all pairs of integers up to some value I've spent an hour on this, and am frustrated that I couldn't figure out a way to do it (without using for_j or while). I want to get all pairs ( pair order not important e.g. 2 3 is the same as 3 2) of integers up to some value. e.g. up to 4: 0 1 0 2 0 3 1 2 1 3 2 3 in frustration this is what I came up with (for the case of 10): /:~ ~. /:~"1 (1000 # 2) ? 10 which works but is not a very good solution. Any nice solutions? Thanks, Jon ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
