> From: [email protected]
> 
> David Ward Lambert wrote:
> >NB. Write a function to number the rows of its argument.
> >NB. Example: `a' is an n-dimensional numerical array.
> >NB. I created this pretty length error:   (i.*/}:$a),"0 _1 a
> 
> Not too bad, but your */ was overdoing it.
> 
>       (i.}:$a) ,"0 1 a
> 
> gives you structured indexes which will then match one-on-one against
> the rows.

Yes my solution was a tacit equivalent of that:
   numberRows=: ,"0 1~ i...@}:@$
   numberRows a
0 0 1
1 2 3

2 4 5
3 6 7

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

Reply via email to