As a side effect of the thread 'Turning 0 into _1 1 in a list' there is
the question of reducing rank or should I say 'flattening' array's.

Iterative one for reducing arbitrary rank to a defined lower rank:
 rank flatI array

  2(,/@])^:(<[EMAIL PROTECTED])^:_ i.2 2 3 3
 0  1  2
 3  4  5
 6  7  8
 9 10 11
12 13 14
15 16 17
18 19 20
21 22 23
24 25 26
27 28 29
30 31 32
33 34 35

don't touch:
   2(,/@])^:(<[EMAIL PROTECTED])^:_ i.3
0 1 2

non-iterative to rank 2
 flat22 array

   ((*/@}:,{:)@$$,)i.2 2 3 3
 0  1  2
 3  4  5
 6  7  8
 9 10 11
12 13 14
15 16 17
18 19 20
21 22 23
24 25 26
27 28 29
30 31 32
33 34 35

don't touch
   ((*/@}:,{:)@$$,)i. 3
0 1 2

Is this the right way to handle this?


=@@i

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

Reply via email to