Wow ! 1) I learned how to use power to control conditional execution. I never saw this one coming. 2) I like the way the partition sort is obviated by adding to indices a cumulative sum. Why am I not so creative ?
Thank you much Roger ! NB. I may change the APL algo as well for 2) ;O) Paul Gauthier APL Software Developer - Senior [EMAIL PROTECTED] Phone: 312-739-3467 Fax: 312-739-3496 CheckFree. The Company that Powers Payment on the WebSM. http://www.checkfree.com/paybillsonline Roger Hui <[EMAIL PROTECTED]> Sent by: [EMAIL PROTECTED] 05/31/2007 06:26 PM Please respond to General forum <[email protected]> To General forum <[email protected]> cc Subject Re: [Jgeneral] Re: Challenge to expert J'ers tgu3=: 3 : 0 i=. /:y p=. 1 (0})^:(*#y) (~: _1&|.) i{y i/:i++/\p*#y ) x=: ,(0,-9!:18'')+/1+i.5e5 (tgu -: tgu3) x 1 ts=: 6!:2 , 7!:[EMAIL PROTECTED] ts 'tgu x' 2.62876 1.15827e8 ts 'tgu3 x' 1.54044 3.9324e7 ----- Original Message ----- From: [EMAIL PROTECTED] Date: Thursday, May 31, 2007 4:10 pm Subject: Re: [Jgeneral] Re: Challenge to expert J'ers > I also forgot the empty case (shame on me) so here they are again: > tgu=: 3 : 0 > if. (0 e. $ y) do. y return. end. > ix=./:y > sy=.ix{y > p=.sy~:_1|.sy > one=.1 > p=.one 0}p > sy=.p < ;.1 ix{i.#y > ;(/:&.>sy){&.>sy > ) > > tgd=: 3 : 0 > if. (0 e. $ y) do. y return. end. > ix=.\:y > sy=.ix{y > p=:sy~:_1|.sy > one=.1 > p=.one 0}p > sy=.p < ;.1 ix{i.#y > ;(\:&.>sy){&.>sy > ) ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
