Apply the 1&p: to the list before doing the infixes. Cuts down the number of times 1&p: is invoked. But why are you adding one to the number of items in each infix? Seems like the 3 5 7 9 should give 0.75, not 0.6 .
((+/%#)&,)\_4,\1 p:3 5 7 9 13 17 21 25 31 37 43 49 On Sun, Sep 25, 2011 at 1:47 PM, David Vaughan <[email protected] > wrote: > I've done: verb&,\ > > I arranged the list to be of shape 'x 4'. This seems to work. The problem > I'm now having is that my verb is slow. Can this be refined (significantly)? > > +/@:(1&p:) % 1&+@:# > > It takes finds the percentage of items in the list which are prime. > > On 25 Sep 2011, at 20:04, Don Guinn wrote: > > > verb=.< > > (verb&,)\_4,\3 5 7 9 13 17 21 25 31 37 43 49 > > +-------+-------------------+-------------------------------+ > > |3 5 7 9|3 5 7 9 13 17 21 25|3 5 7 9 13 17 21 25 31 37 43 49| > > +-------+-------------------+-------------------------------+ > > > > > > On Sun, Sep 25, 2011 at 12:44 PM, David Vaughan < > > [email protected]> wrote: > > > >> I'm trying to apply a verb to infixes of length 4 but I want it to be > >> cumulative. i.e. in the list: > >> > >> 3 5 7 9 13 17 21 25 31 37 43 49 > >> > >> I want: > >> > >> verb 3 5 7 9 > >> verb 3 5 7 9 13 17 21 25 > >> verb 3 5 7 9 13 17 21 25 31 37 43 49 > >> > >> Any help? Thanks. > >> ---------------------------------------------------------------------- > >> 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
