table=. 4 3 $ 'aaa';'aa';'a';'bbb';'bb';'b';'ccc';'cc';'c';'ddd';'dd';'d'
(<0) (<0 0) } table
+---+--+-+
|0 |aa|a|
+---+--+-+
|bbb|bb|b|
+---+--+-+
|ccc|cc|c|
+---+--+-+
|ddd|dd|d|
+---+--+-+
(<3) (<3 0) } table
+---+--+-+
|aaa|aa|a|
+---+--+-+
|bbb|bb|b|
+---+--+-+
|ccc|cc|c|
+---+--+-+
|3 |dd|d|
+---+--+-+
2008/7/30 Hahn, Harvey <[EMAIL PROTECTED]>
> 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
>
--
Björn Helgason, Verkfræðingur
Fugl&Fiskur ehf,
Fornustekkum II, 781 Hornafirði
Po Box 127,801 Selfoss ,
t-póst: [EMAIL PROTECTED]
gsm: +3546985532
Landslags og skrúðgarðagerð, gröfuþjónusta
http://groups.google.com/group/J-Programming
Tæknikunnátta höndlar hið flókna, sköpunargáfa er meistari einfaldleikans
góður kennari getur stigið á tær án þess að glansinn fari af skónum
/|_ .-----------------------------------.
,' .\ / | Með léttri lund verður |
,--' _,' | Dagurinn í dag |
/ / | Enn betri en gærdagurinn |
( -. | `-----------------------------------'
| ) | (\_ _/)
(`-. '--.) (='.'=)
`. )----' (")_(")
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm