On Fri, 07 Aug 2009, Sherlock Ric wrote:
> Obviously the best solution is to prevent the 0 fills in the first place 
> using one of the methods described. But if you really want to count the 
> non-zero numbers in each row of an array, then you could do this:
>       q: 453 32
> 3 151 0 0 0
> 2   2 2 2 2
>    #...@-.&0"1 q: 453 32
> 2 5
>
> countrows is an explicit verb that would do the same thing:
>    countrows=: 3 : '# y -. 0'"1
>    countrows q: 453 32
> 2 5

I guess the tacit form (ignoring "1) is #...@-.&0 is interpreted as
(#...@-.)&0 but the explicit form is #@:(-.&0)

--
regards,
====================================================
GPG key 1024D/4434BAB3 2008-08-24
gpg --keyserver subkeys.pgp.net --recv-keys 4434BAB3
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to