> From: bill lam
> 
> 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)

I think I understand the idea you're trying to express but when I look at the 
"definition" of a tacit expression from 
"http://www.jsoftware.com/jwiki/Essays/Tacit%20Expressions"; it appears that all 
three expressions are tacit?

"A tacit expression is a sequence of J operations, which can be separated from 
its arguments. In other words, it preserves its features when put between 
parentheses or assigned to a name."

   (#...@-.&0) 3 151 0 0 0
2
   ((#...@-.)&0) 3 151 0 0 0
2
   (#@:(-.&0)) 3 151 0 0 0
2

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

Reply via email to