Very interesting. Quite a difference in space and time usage, not to mention length of the tacit code.
For my application, a rank 0 or 1 in the summed result isn't all that critical. As long as the contents of each box can be used in further arithmetic and Boolean operations (e.g. it's not text), then I'm ok. It looks like nouns with ranks 0 or 1 don't affect the outcome of simple arithmetic operations: ($4);($,4);(4=,4);(1+4);(1+,4);((1+4)=1+,4);($1+4);($1+,4) ┌┬─┬─┬─┬─┬─┬┬─┐ ││1│1│5│5│1││1│ └┴─┴─┴─┴─┴─┴┴─┘ The only time the difference becomes an issue: ($4)=($,4) |length error | ($4) =($,4) But I don't care about this. Actually, Mike Day spotted what I was really trying to attempt. The original starting vector is: n =: 1 2 2 4 1 5 3 4 4 4 2 3 3 Then I box at each possible pair of integers using an infix sliding-window on each pair of integers. This sliding box scheme was just to identify all the duped pairs in the original vector. ]N =: 2<\pp ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┐ │1 2│2 2│2 4│4 1│1 5│5 3│3 4│4 4│4 4│4 2│2 3│3 3│ └───┴───┴───┴───┴───┴───┴───┴───┴───┴───┴───┴───┘ What I ultimately wanted is a verb that will replace the duped pairs in the *original* un-boxed vector, one at a time: n =: 1 2 2 4 1 5 3 4 4 4 2 3 3 f n 1 4 4 1 5 3 4 4 4 2 3 3 1 2 2 4 1 5 3 8 4 2 3 3 1 2 2 4 1 5 3 4 8 2 3 3 1 2 2 4 1 5 3 4 4 4 2 6 Of course, the final row lengths will be one shorter that the original row length. Skip ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
