Pacal, the solution proposed has a problem as it does not scale right.
Looks like there is an assumption on the shape somewhere.

Let me call the rajoin you have proposed as rajoin1.

  rajoin1 =: 4 : '(x ,. ]) (({: |: x) i.~ ({. |: y)) { {: |: y'

Now, try this:
  x =. 15 3 $ 12 | 45 ?. 200
  y =. 10 4 $ 12 | 40 ?. 60

  x rajoin1 y
|index error: rajoin1
|   (x,.])(({:|:x)i.~({.|:y))    {{:|:y

However,
  x rajoin y
+----+--+-------+
|2 6 |7 |7 0 5  |
+----+--+-------+
|2 6 |7 |1 3 3  |
+----+--+-------+
|7 6 |5 |11 8 8 |
+----+--+-------+
|8 6 |0 |0 9 3  |
+----+--+-------+
|4 2 |4 |9 5 8  |
+----+--+-------+
|8 10|5 |11 8 8 |
+----+--+-------+
|6 11|7 |7 0 5  |
+----+--+-------+
|6 11|7 |1 3 3  |
+----+--+-------+
|7 10|5 |11 8 8 |
+----+--+-------+
|9 2 |4 |9 5 8  |
+----+--+-------+
|11 8|6 |11 1 10|
+----+--+-------+
|0 5 |10|8 8 1  |
+----+--+-------+
|0 5 |10|11 4 3 |
+----+--+-------+
|0 5 |10|4 3 7  |
+----+--+-------+

]x
2  6  7
7  6  5
8  6  0
4  2  4
9  4  9
8 10  5
6 11  7
7 10  5
4 11  3
2  1  9
9  2  4
11  8  6
11  0  1
0  5 10
5 10 11
]y
6 11 1 10
10  8 8  1
5 11 8  8
2  0 1  5
10 11 4  3
7  7 0  5
0  0 9  3
10  4 3  7
4  9 5  8
7  1 3  3


On 10/23/06, Pascal Jasmin <[EMAIL PROTECTED]> wrote:
this will work if y is sorted (easily fixed if not) and indexed continuously 
(left column) from 1 to #y

(x ,. ]) (1 -~ {: |: x) { {: |: y

otherwise, we need to make an indexlookup verb (just i.~) as the left argument 
for { .

(x ,. ]) (({: |: x) i.~ ({. |: y)) { {: |: y
rajoin =: 4 : '(x ,. ]) (({: |: x) i.~ ({. |: y)) { {: |: y'

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

Reply via email to