How about:
   f=: +//.~&.>

Does that work for you?

Thanks,

-- 
Raul


On Mon, Nov 7, 2016 at 2:23 AM, Skip Cave <[email protected]> wrote:
> Problem update:
>
> Instead of starting with multiple duplicated rows, I want to start with one
> row containig boxed pairs of integers
>
>  n
>
> ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┐
>
> │1 2│2 2│2 4│4 1│1 5│5 3│3 4│4 4│4 4│4 2│2 3│3 3│
>
> └───┴───┴───┴───┴───┴───┴───┴───┴───┴───┴───┴───┘
>
> I want to design a verb f such that it will find boxes containing duplicate
> pairs in n. f will sum the duplicate pairs, and replace the boxed duplicate
> pair with a box containing the sum of the two integers. However, I want to
> create a new row for each dup pair we find, and append that new row on the
> bottom of the specific dup pair with the sum of the two numbers. See the
> result below.
>
> f n
>
> ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┐
>
> │1 2│ 4 │2 4│4 1│1 5│5 3│3 4│4 4│4 4│4 2│2 3│3 3│
>
> ├───┼───┼───┼───┼───┼───┼───┼───┼───┼───┼───┼───┤
>
> │1 2│2 2│2 4│4 1│1 5│5 3│3 4│ 8 │4 4│4 2│2 3│3 3│
>
> ├───┼───┼───┼───┼───┼───┼───┼───┼───┼───┼───┼───┤
>
> │1 2│2 2│2 4│4 1│1 5│5 3│3 4│4 4│ 8 │4 2│2 3│3 3│
>
> ├───┼───┼───┼───┼───┼───┼───┼───┼───┼───┼───┼───┤
>
> │1 2│2 2│2 4│4 1│1 5│5 3│3 4│4 4│4 4│4 2│2 3│ 6 │
>
> └───┴───┴───┴───┴───┴───┴───┴───┴───┴───┴───┴───┘
>
> The row append process stops if all duplicates have been found.
>
> Can this be done without control statements?
>
> Skip
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to