(/:@({~ i.~) -: tgu3) x
1
ts 'tgu3 x'
1.29363 4.2994e7
ts '/:@({~ i.~) x'
1.22371 1.73028e7
--- Roger Hui <[EMAIL PROTECTED]> wrote:
> 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
>
____________________________________________________________________________________
Park yourself in front of a world of choices in alternative vehicles. Visit the
Yahoo! Auto Green Center.
http://autos.yahoo.com/green_center/
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm