Hi!

(Apologies if this is a double-post, I believe I sent it before I was
officially on the mailing list, and I don't see it in the archives).

Given:

|:xs

 1   23
 2    4
 3    5
 4   10
 5  397
 6    3
 7  190
 8   44
 9    4
10    5
11   13
12 1011
13   10
14 1119
15   72
16    1
17    1
19    6
21    3
22    2
23    1
26    2
28    2
29    2
30    1
31    2


I'd like $xs to be 2 31 but you can see that 18, 20, 24, 25, and 27
are "missing".


I'd like to "fill the holes" so the first row of xs is all the
integers 1 through 31 sequentially, and to put corresponding zeros in
the second row where I've filled the holes in the first.


My thoughts have centered around using (1+i.31),.31#0 to have a 2 by
31 array with all zeros in the second row, and then shifting my
original to find the non-sequential parts with something like:


(1|.{.xs) - {.xs


But then I'm struggling to reason about a non-loopy way to put it all
together. Any help is greatly appreciated.


Kind regards,

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

Reply via email to