> From: david alis
>    b=. +&.>/
>    NB. this is equivalent to 1 (+&.>) 2(+&.>) 3 (+&.>) 4
>    NB. which is wasteful. The following is better.
>    b=.  [: < [: +/ >
> 


  (+&.>//.)/ 
  ([: < [: +/ >)/./

I don't think the performance hit is that big for smaller arguments, but if I 
was interested in better performance I'd use something more like this to take 
advantage of special code for +//.
  ([: <"0 {. +//. >@{:)

Or I'd use an inverted table as suggested by Bill Lam.

----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to