(#~ </"1)@(#: i.@:(*/)) 5 5

(#: i.@:(*/)) is supported by special code.

Henry Rich

On 12/18/2015 8:45 AM, 'Jon Hough' via Programming wrote:
Thanks, odometer looks promising.
  od1=: > @ , @ { @ (i.&.>"_)

(((0&{) < (1&{))"1 # ]) od1 5 5

0 1
0 2
0 3
0 4
1 2
1 3
1 4
2 3
2 4
3 4

# (((0&{) < (1&{))"1 # ]) od1 10 10

45

seems to work.

Thanks.
--------------------------------------------
On Fri, 12/18/15, Joe Bogner <[email protected]> wrote:

  Subject: Re: [Jprogramming] Getting all pairs of integers up to some value
  To: [email protected]
  Date: Friday, December 18, 2015, 10:32 PM
odometer is definitely
  the way to go compared to my idea
On Fri, Dec 18, 2015 at 8:29 AM, Raul Miller
  <[email protected]>
  wrote:
  > http://www.jsoftware.com/jwiki/Essays/Odometer
  might interest you.
  >
  > Thanks,
  >
  > --
  > Raul
  >
  >
  >
  On Fri, Dec 18, 2015 at 7:58 AM, 'Jon Hough' via
  Programming
  > <[email protected]>
  wrote:
  >> 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
  ----------------------------------------------------------------------
  For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to