'Pascal Jasmin' asked:
>what verb v (or I guess adverb is ok) could I use to get
>
> i.2 3 2
> 0 1
> 2 3
> 4 5
>
> 6 7
> 8 9
>10 11
>
> 0 1 1 v i. 2 3 2
>0 1
>8 9
>10 11
So you want some bastard item merged out from the original ones.
This is exactly what monadic } will do, the difficult part is
moving from the rank-1 items in the DoJ example to your rank-2 items.
Instead of 0 1 1, your "merge selector" has to be rank-2, too:
0 0
1 1
1 1
Altogether:
(,.~0 1 1)} i. 2 3 2
0 1
8 9
10 11
For a single "v" encapsulation and general rank/shape case, things
become a bit ugly. As adverb:
v =. 1 : '((2}.$y) $"1 0 m)} y'
0 1 1 v i. 2 3 5
0 1 2 3 4
20 21 22 23 24
25 26 27 28 29
Martin
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm