Reputation: 13
I want to sort the array in NetLogo. Like this {{array: 22 16 10 7}}
how can I achieve it?
Thanks
Upvotes: 0
Views: 115
Reputation: 30453
The array extension doesn't provide for sorting.
Consider using a list instead. Normally in NetLogo we use lists and agentsets for everything; using arrays at all is rare.
But, assuming you really need a sorted array, you could copy the array to a list, sort the list, then make a new array from the result. (Or store the sorted items back into the original array, one at a time.)
Upvotes: 1