On Wed, Dec 2, 2009 at 12:11 PM, Dan Bron <[email protected]> wrote:
> Robert O'Boyle wrote:
>>  I would like 3 numbers output - 2 for row 1, 7 for row 2 and 16.5 for row 4
>
> No, you do not.  You want 4 numbers output:  2 7 0 16.5.  This is very
> important.
>
> If you every try to marry these results with others (or even back to the
> original data), then you must have one output per input.
>
> If this really is the final result of your program, to be displayed to a
> human and never touched by J again, then you may scrub zeros from it using

And, if scrubbing for a human is really what you want:
   b=: 0 1 1 1 0, 1 1 1 1 1, 0 0 0 0 0,: 1 1 1 1 0
   (+./"1 b)#2 7 0 16.5
2 7 16.5

And, for that matter:
   (+./"1 b)#inv 2 7 16.5
2 7 0 16.5

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

Reply via email to