NetLogo / Tortoise

Compiler and runtime engine for NetLogo models that runs in JavaScript 🐢
https://netlogoweb.org
Other
56 stars 27 forks source link

sort of RGB colors causes "We don't know how to sort your kind here!" #180

Closed TheBizzle closed 8 years ago

TheBizzle commented 8 years ago

From @ToonTalk on March 28, 2016 6:53

observer> show sort [color] of turtles observer: [5 45 45 45 105 105]

The following triggers an error with the message "We don't know how to sort your kind here!"

observer> show sort [pcolor] of n-of 6 patches

This was very confusing until I saw that the patch colors were RGB. [[77 188 253] [77 188 253] [255 255 255] [77 188 253] [229 77 253] [229 77 253]]

The desktop version returns [] with no error (which is odd but documented):

sort list sort agentset Reports a sorted list of numbers, strings, or agents.

If the input contains no numbers, strings, or agents, the result is the empty list.

Copied from original issue: NetLogo/Galapagos#337

TheBizzle commented 8 years ago

While there's a real problem here (for which a fix is in-progress), it's worth mentioning that the following code (for either NLW or desktop NetLogo) should accomplish something along the lines of what you seem to be wanting to do: sort (map [approximate-rgb (item 0 ?) (item 1 ?) (item 2 ?)] my-favorite-list)

TheBizzle commented 8 years ago

The fix for this is now available on netlogoweb.org .