Turtle and Observer Command

average-of-patches-with [1st list of commands] [2nd list of commands]

Returns the numerical average of the [2nd list of commands] when evaluated across all the patches that satisfy the conditions (must return a boolean of true or false) specified by the [1st list of commands].

Note: If [2nd list of commands] contains no numbers, an error occurs. If some of the [2nd list of commands], when evaluated, are not numbers, those values are ignored.

Examples:
average-of-patches-with [color = red] [food] returns the average food of all the red patches.


Related commands:
average-of-list average-of-patches