I have read and re-read the "Amend" and "For" dictionary entries as well as the 
"For" entries in the Rich and Stokes online books, and I have tried a couple of 
experimental variations with no luck.  Here's a simplified example of the 
problem I'm having:

test=: 3 : 0
table=. 4 3 $ 'aaa';'aa';'a';'bbb';'bb';'b';'ccc';'cc';'c';'ddd';'dd';'d'
numrows=. 0{$table
for_j. (i. numrows) do.
  testfld=. < j_index          NB. create arbitrary new field contents
  testfld (0{j_index)} table   NB. put new contents into first cell in row
end.
)

   test''
+---+--+-+
|aaa|aa|a|
+---+--+-+
|bbb|bb|b|
+---+--+-+
|ccc|cc|c|
+---+--+-+
|3  |3 |3│
+---+--+-+

Why do I get the above table instead of the intended table below?

+-+--+-+
|0|aa|a|
+-+--+-+
|1|bb|b|
+-+--+-+
|2|cc|c|
+-+--+-+
|3|dd|d│
+-+--+-+

What am I missing about the "Amend" and/or "For" commands?  Thanks in advance 
for your guidance!

Harvey

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

Reply via email to