I guess it might be a good idea to put one or more of these solutions into utility verbs or phrases?
2008/11/5 Roger Hui <[EMAIL PROTECTED]> > It has been a long quest in APL/J to make > x e. y as fast as 1 x1}y1 . The quest continues. > > I must say that I like Brian Schott's solution (I.x)</.y > the best. The implementation should reward concise > solutions and I'll see if I can make that solution faster. > > > > ----- Original Message ----- > From: "Sherlock, Ric" <[EMAIL PROTECTED]> > Date: Tuesday, November 4, 2008 22:57 > Subject: RE: [Jprogramming] cut on length > To: Programming forum <[email protected]> > > > ---Roger Hui wrote: > > > f0=: 4 : '(I.x)</.y' > > > f1=: 4 : '((i.#y) e. +/\0,x) <;.1 y' > > > > > > x=: 1+1e4 [EMAIL PROTECTED] 100 > > > y=: t {~ (+/x) [EMAIL PROTECTED] #t=. 'barack obama' > > > > > > x (f0 -: f1) y > > > 1 > > > ts=: 6!:2 , 7!:[EMAIL PROTECTED] > > > > > > ts 'x f0 y' > > > 0.0700156 1.09591e7 > > > ts 'x f1 y' > > > 0.00778395 4.20992e6 > > > > When I saw Brian's solution I wasn't going to post mine - his > > was so much simpler (BTW I have only used monadic I. to turn a > > boolean into an index of 1s and hadn't realised what it did with > > integers). Roger's post prompted me to time mine and the result > > surprised me. > > > > f2=: 4 : '(1 (<:+/\x)} (#y)$0) <;.2 y' > > x (f1 -: f2) y > > 1 > > 50 ts 'x f0 y' > > 0.030942459167 10976256 > > 50 ts 'x f1 y' > > 0.0077791269561 4227072 > > 50 ts 'x f2 y' > > 0.0060425808308 2654272 > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm > -- Björn Helgason, Verkfræðingur Fugl&Fiskur ehf, Þerneyjarsundi 23, Hraunborgum Po Box 127,801 Selfoss , t-póst: [EMAIL PROTECTED] gsm: +3546985532 Landslags og skrúðgarðagerð, gröfuþjónusta http://groups.google.com/group/J-Programming Tæknikunnátta höndlar hið flókna, sköpunargáfa er meistari einfaldleikans góður kennari getur stigið á tær án þess að glansinn fari af skónum /|_ .-----------------------------------. ,' .\ / | Með léttri lund verður | ,--' _,' | Dagurinn í dag | / / | Enn betri en gærdagurinn | ( -. | `-----------------------------------' | ) | (\_ _/) (`-. '--.) (='.'=) `. )----' (")_(")
---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
