Reputation: 733
I'm trying to map a variable of patches in the same order as the list they were generated in (see code below). However, I get an "error while observer running SET test2" because it cannot be run in the observer context. I do not understand this as it seems like a straightforward procedure.
globals [test test2]
patches-own [wealth]
to setup
ca
ask patches
[set wealth random 100]
end
to go
set test [self] of patches
show test
set test2 map [wealth] test
show test2
end
Upvotes: 0
Views: 74
Reputation: 9610
You can change set test2 map [wealth] test
to set test2 map [x -> [wealth] of x] test
. However, whenever you are working with lists of agents instead of agentsets, you should ask whether this is really necessary.
Upvotes: 2