NetLogo - Add a single value to a list of lists

Viewed 1390

I'm trying to enter a value into a list of lists when necessary.

I define a list globally:

set mylist [[[][]][[][]]]

At various stages of the simulation, I wish to have an agent insert a value into the list (these values will make up their own lists). For example, if I wanted to add the value 2 to item 0 of item 1, I'd put:

....
set item 0 item 1 mylist lput 2 item 0 item 1 mylist
....

Which returns the error message "This isn't something you can use "set" on." Any help? I seem to have a fundamental misunderstanding about adding to lists.

FYI my inteded return for the example above would be for mylist to become:

[[[][]][[2][]]]

(And a different agent would have the opportunity to add another value to item 0 of item 1 later in the simulation if needed).

Thanks

1 Answers
Related