nl =. +/&.:<:@:(*/\)`0:@.(0&e.)@}:@$
nl i. 3 4 5
14
nl i. 0 0
0
nl i. 0 1
0
nl i. 1 0
1
nl i. 2 2 2 2 1
27
The agenda part is to handle the case of empty operands, which seem
anomalous:
i. 0 2 3
displays nothing, which I expect, but you could make a case that
i. 2 0 3
should display a space between two empty arrays. I assume that the
observed behavior is better thought out than my first guess.
Henry Rich
Roger Hui wrote:
> If x is a rank 2 or higher numeric array, how many
> lines are in the display of x? For example,
> there are 14 lines in the display of i. 3 4 5 .
>
> I've worked on a related problem on-and-off for years,
> starting in 1991, and only came to a good answer
> for this problem just a few days ago.
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm