Forced array instead of matrix in J for "i".

The primitive i.creates a list of integers:

   i. 10
0 1 2 3 4 5 6 7 8 9

If I want to create several short lists in a row, I do this:

   ;i."0 each [ 2 3 4
0 1 0 1 2 0 1 2 3

(the result I want)

Boxing (this each) is a crutch here, because without it it i."0creates a matrix.

   i."0 [ 2 3 4
0 1 0 0
0 1 2 0
0 1 2 3

(I do not need the result)

Is there a better way to not i."0format the output in a matrix, but an array?

+3
source share
1 answer

No, I believe that you can do nothing better than your current decision. There is no way to return a i."0vector.

"0 i. , i. . i. , , . J- .

" " , ,

(*@$"0~#&,i."0) 2 3 4

, ;i. each 2 3 4

+1

All Articles