What is the fastest way to replace the atoms in y which occur in {.x by the
corresponding values in {:x, where 2={.$x and 2=#$x?

As a benchmark, I have rpl with

   X9=:(,:-)90?.100
   Y9=:100 100 100 [EMAIL PROTECTED]
   ts'X9 rpl Y9'
0.067118308 20972416

Example:
   ((,:-)6?.10) (];rpl) 10 10 [EMAIL PROTECTED]
+-------------------+----------------------------+
|6 5 9 2 4 9 0 7 0 4|_6  5 _9 _2 _4 _9  0 7  0 _4|
|6 8 3 8 1 2 8 0 0 2|_6  8  3  8 _1 _2  8 0  0 _2|
|1 6 0 4 4 1 3 3 6 6|_1 _6  0 _4 _4 _1  3 3 _6 _6|
|5 7 8 8 2 1 9 7 9 9| 5  7  8  8 _2 _1 _9 7 _9 _9|
|1 4 3 9 7 2 4 3 7 5|_1 _4  3 _9  7 _2 _4 3  7  5|
|3 8 3 6 5 7 7 5 6 3| 3  8  3 _6  5  7  7 5 _6  3|
|7 9 4 7 5 8 9 5 1 9| 7 _9 _4  7  5  8 _9 5 _1 _9|
|3 1 4 5 8 2 7 0 7 7| 3 _1 _4  5  8 _2  7 0  7  7|
|6 2 6 9 2 9 1 3 7 8|_6 _2 _6 _9 _2 _9 _1 3  7  8|
|7 8 7 2 7 5 6 5 4 9| 7  8  7 _2  7  5 _6 5 _4 _9|
+-------------------+----------------------------+

rpl=: ([EMAIL PROTECTED])$ (((,~{:){~(,~{.)i.[)~,)


R.E. Boss

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

Reply via email to