Raul,
One of us must have misunderstood the other. Unless I'm mistaken,
your solution:
drag=: # {. ] -. 1 {. 0 {. ]
simply moves fills to the end of the array. That is not what I want.
In my original message, I gave an example:
drag0 =: {~ (I. {~ _1 + +/\)@: (+./"1@:~:&' ')
mockData =: ] ((<. #)~ { ({.~ 1: + #)@:[) 0: , ([EMAIL PROTECTED]
(>[EMAIL PROTECTED] 2r3&*)@:#)
M =: 10 mockData >;:'ABC DEF GHI JKL MNO PQR STUV WXY Z'
Here is a comparison of the input data, my solution, and yours:
drag =: # {. ] -. 1 {. 0 {. ]
(M ; drag0 ; drag) M
+----+----+----+
|ABC |ABC |ABC |
|STUV|STUV|STUV|
|PQR |PQR |PQR |
| |PQR |WXY |
|WXY |WXY |PQR |
| |WXY |WXY |
| |WXY | |
|PQR |PQR | |
|WXY |WXY | |
| |WXY | |
| |WXY | |
+----+----+----+
Notice that my (desired) solution does not contain any fills. All
observations are legitimate. Each gap (fill item) has been replaced
with the closest preceding legitimate observation (non-fill item).
The size of the file is only relevant because it has forced me to use
mapped nouns, which might provide an opportunity for a different kind
of fast solution (vide DRAG from my first message).
-Dan
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm