(2&!) -: +/@,@(</~)@i. can be understood if one realises that
(+/@,@(</~)@i.) -: [:+/ [:+/\ <:#1: is a special case in a more general theory: Since for all x and y we have ((x+1)!y) -: +/x!x+i.y-x as in ((x+1)!y); (x+i.y-x); +/x!x+i.y-x ['x y'=.3 10 +---+-------------+---+ |210|3 4 5 6 7 8 9|210| +---+-------------+---+ you may conclude that (+/\^:(i.`(#1:))) -: ([ ! +)"0 [EMAIL PROTECTED] as in ((+/\^:(i.`(#1:))) ; ([ ! +)"0 [EMAIL PROTECTED])7 +---------------------+---------------------+ |1 1 1 1 1 1 1|1 1 1 1 1 1 1| |1 2 3 4 5 6 7|1 2 3 4 5 6 7| |1 3 6 10 15 21 28|1 3 6 10 15 21 28| |1 4 10 20 35 56 84|1 4 10 20 35 56 84| |1 5 15 35 70 126 210|1 5 15 35 70 126 210| |1 6 21 56 126 252 462|1 6 21 56 126 252 462| |1 7 28 84 210 462 924|1 7 28 84 210 462 924| +---------------------+---------------------+ R.E. Boss -----Oorspronkelijk bericht----- Van: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Namens Ken Chakahwata Verzonden: dinsdag 11 november 2008 13:23 Aan: 'Programming forum' Onderwerp: RE: [Jprogramming] pairs Oleg, thanks for highlighting that ((2&!) -: +/@,@(</~)@i.) y Regards ken -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Oleg Kobchenko Sent: 10 November 2008 22:40 To: Programming forum Subject: Re: [Jprogramming] pairs Here's a tacit variation, where we filter scalars before making pairs: (0&, #: ,@(</~)@i. # [EMAIL PROTECTED]:) each 3 4 5 +---+---+---+ |0 1|0 1|0 1| |0 2|0 2|0 2| |1 2|0 3|0 3| | |1 2|0 4| | |1 3|1 2| | |2 3|1 3| | | |1 4| | | |2 3| | | |2 4| | | |3 4| +---+---+---+ > From: Ken Chakahwata <[EMAIL PROTECTED]> > > Oops, finger happy! > > pair8 =: 3 : 0 > t =. (0,y)#: i. (*<:) y > t =. (</"1 t)#t > > ken > > -----Original Message----- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of Roger Hui > Sent: 10 November 2008 21:37 > To: Programming forum > Subject: Re: [Jprogramming] pairs > > Actually, the "amend" idea does not use boxing. > > pair6a=: 3 : 0 > t=. ((2!y),2)$0 1+0 > t=. (1,.-.(-i.)y-2) (}:+/\(-i.)y-1)}t > +/\t > ) > > However, the idea of generating all possible pairs and > then selecting the suitable ones is good. Variations on > that theme: > > pair7 =: (> pair7a=: (> > > > ----- Original Message ----- > From: Andrew Nikitin > Date: Monday, November 10, 2008 11:26 > Subject: [Jprogramming] pairs > To: J programming > > > > > I haven't seen a flat version, that is the one that does not use > > boxing. If I just missed it, sorry for duplication. If there > > wasn't one then here it is. > > > > (> ---------------------------------------------------------------------- > 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
