Turtle and Observer Command

median-of-turtles-with [condition] [list of commands]

Returns the median of [list of commands] when [list of commands] is evaluated for all turtles satisfying the specified [condition]. If no turtle satisfies the [condition] then the minnum or the smallest possible number is returned.

Note: When a turtle calls the command, it is not included as part of the calculation.

Examples:
median-of-turtles-with [heading > 50] [color] returns a number corresponding to the median of the colors of all turtles with heading greater than 50 degrees.

Related commands:
median-of-turtles median-of-frogs-with median-of-patches-with average-of-turtles variance-of-turtles