Chito asked:
>  I want to modify [A] such that overlaps of the four-digit entries (eg, 
> '8381',
>  '7893') in [A] & [B] will result in the associated decimal string in [B] (eg,
>  '.0418' and '.0085') being inserted into the position shown in the
>  corresponding rows in [A],  ie

The following works, but I offer it without much explanation.  If you want,
I can post more details when I get home tonight:

   A =: ];.2 noun define
TPX~6001342~L~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~9607~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
TPX~6001483~L~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~8381~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
TPX~6004073~L~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~9476~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
TPX~6004664~L~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~6885~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
TPX~6007027~L~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~7893~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
)
   
   B =: ];.2 noun define  NB.  Tab delimited, it seems
TPX     8381 JT .0418
TPX     8382 JT .0947
TPX     7893 JT .0085
)
   
   newA =: noun define
TPX~6001342~L~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~9607~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
TPX~6001483~L~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~.0418~8381~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
TPX~6004073~L~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~9476~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
TPX~6004664~L~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~6885~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
TPX~6007027~L~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~.0085~7893~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
)
   
   
   idx_A   =:  66 4
   idx_B   =:  4 4
   idx_S   =:  12 5
   
   As      =:  A ];.0~  0 _ ,. idx_A
   'Bs Ss' =:  B <;.0~  0 _ ,."1 ] idx_B  ,: idx_S
   
   Vs      =:  (Bs i. As) { (, 0 #&.> {.)@:(<"1) Ss
   
   new_A   =:  ; <@:;"1 Vs (<a:;1)} 1j1 1 #"1 A <@:,;.1~ 1 ; (i. {: $A)  e.
0 , _1 + {.idx_A
   
   assert new_A -: newA
   
-Dan
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to