--- Dan Bron <[EMAIL PROTECTED]> wrote:

> > Running average:
> >   n(+/%#)\
> 
> In the vein of Raul's earlier response to my message, we could make this 
> expression more
> efficient (but perhaps less true to the original?) with:
> 
>     n&(+/\ % [)
> 
> (I think, anyway.  I didn't cheat and ask the interpreter ;)

More efficient?

   ra1=: (+/ % #)\
   ra2=: +/\ % [
   ts=: 6!:2 , 7!:[EMAIL PROTECTED]
   
   T=: 1e7 [EMAIL PROTECTED] 0
   
   5 ts '5 ra1 T'
0.318797 1.34219e8
   5 ts '5 ra2 T'
0.344191 2.68436e8
   
   5 ts '100 ra1 T'
0.319054 1.34219e8
   5 ts '100 ra2 T'
0.34386 2.68436e8
   
   5 (ra1 -: ra2) T
1



      
____________________________________________________________________________________
You rock. That's why Blockbuster's offering you one month of Blockbuster Total 
Access, No Cost.  
http://tc.deals.yahoo.com/tc/blockbuster/text5.com
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to