Modify values ina a list of lists

14 views
Skip to first unread message

Eduardo Navarro Lozano

unread,
Jan 12, 2019, 1:46:30 PM1/12/19
to GAMA
Hi I need to save values in a list of lists that I define like:

list<list<int>> fo;

I save in this list groups of two numbers that represent two values of messagges. The structure is like:

[[1,1],[1,2],[3,2],...]

I have another list of strings that identify the id of each messagge.

list<string> id;

[A11,A12,A13,...]

The position of the values correspond in both list

A11 [1,1] , A12 [1,2] , ...

Now, I need to update some values of this list, for example in the second group [1,2] -> [1,3]

I'm doing this like:

int ins_pos <- id index_of answer[0][2]; //answer[0][2] is the ID in the messagge

int new_value <- fo[ins_pos][1]+1; //fo[ins_pos][1] because I want to modify the second value

put new_value in: fo at:[ins_pos][1];

But I always obtain an error.

Could somebody help me?

Thanks a lot!

Srirama Bhamidipati

unread,
Jan 13, 2019, 5:25:10 AM1/13/19
to GAMA
Hi

the `at` takes a position, not a list, so you should write 

put new_value in:fo[ins_pos] at:1;



Srirama
Reply all
Reply to author
Forward
0 new messages