I wrote:
>   N=: (^&)(+&|/&.:)

This is probably a better approach:

   N=: (^&)(+/@:|&.)

   1 N 3 _4 12
19
   2 N 3 _4 12
13

The big advantage is that | is applied to the entire array, instead
of to items.  Also, I realized that &. works fine.

That said, it would be nice if J treated ] as the obverse of the | monad.

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

Reply via email to