I want to dynamically add elements to nested lists. Consider the following example:
set super_list {}
lappend super_list {00 01 02}
lappend super_list {10 11 12}
lappend super_list {20 21}
results in:
super_list = {00 01 02} {10 11 12} {20 21}
[lindex $super_list 0] = {00 01 02}
[lindex $super_list 1] = {10 11 12}
[lindex $super_list 2] = {20 21}
How do I append another value (e.g. 22) to [lindex $super_list 2]?
lappend [lindex $super_list 2] 22
does not work!
The only workaround I could think of so far is:
lset super_list 2 [concat [lindex $super_list 2] {22}]
Is this really the only way?
Thanks, Linus