This is relevant to the previous question just asked.
How can I convert list(which representing turtles) to a agentset?
For example, I want to make
agentset which contains 4 elements [turtle 0 turtle 3 turtle 4 turtle 7]
out of list ["turtle 0" "turtle 3" "turtle 4" "turtle 7"]
I've tried "foreach" before.
Thank you in advance~!!
I am not sure why you would need to work with a list like
["turtle 0" "turtle 3" "turtle 4" "turtle 7"]
in the first place. Storing references to agents as anything other than direct references to the agents is usually not a good idea.
That being said, you can convert such a string to an agentset with:
turtle-set map runresult ["turtle 0" "turtle 3" "turtle 4" "turtle 7"]
If any of those turtles don't exist, they will just be excluded from the resulting agentset.
Still, the whole thing strikes me as somewhat ill advised. If you tell us more about what you're trying to accomplish, maybe we could suggest a better approach altogether.