Correction - you'd need two "each"s with your f: f &.>&.> (],&.> i.) &.> >: i. 23
On Thu, Sep 15, 2011 at 5:14 PM, Devon McCormick <[email protected]> wrote: > Something like > (],&.>i.) > would generate all your (x,y) pairs, e.g. for "3" instead of "24" for ease > of display: > (] ,&.> i.) &.> 1 2 3 > +-----+---------+-------------+ > |+---+|+---+---+|+---+---+---+| > ||1 0|||2 0|2 1|||3 0|3 1|3 2|| > |+---+|+---+---+|+---+---+---+| > +-----+---------+-------------+ > > So, to run verb "f" for x>0 and <24, you could do something like: > > f &.> (] ,&.> i.) &.> >:i.23 > > > On Thu, Sep 15, 2011 at 4:18 PM, David Vaughan < > [email protected]> wrote: > >> Hi, >> >> I have a dyadic verb I wish to apply to x and y where x>y and 0<x<24, >> 0<=y<x. >> >> I want to be able to apply the verb to every single possible pairing of x >> and y that is legal (i.e. where x>y). >> >> If it were C I would just do: >> >> for(x=1;x<24;x++) >> for(y=0;y<x;y++) >> { >> // do verb on x and y >> } >> >> So I need an equivalent to that basically, in J. >> >> Any help would be appreciated. >> Thanks. >> ---------------------------------------------------------------------- >> For information about J forums see http://www.jsoftware.com/forums.htm >> > > > > -- > Devon McCormick, CFA > ^me^ at acm. > org is my > preferred e-mail > > -- Devon McCormick, CFA ^me^ at acm. org is my preferred e-mail ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
