Turtle, Observer, Patch

sum-of-patches-with [condition] [list-of-commands]

Parameters:
[condition] List of commands list of commands that evaluates to either true or false
[list-of-commands] List of commands list of commands that returns a number

Description:
Reports the total value of [list-of-commands] when run over the turtles that satisfy [condition]. If there are no patches in which [condition] is true, it reports 0.

Examples:
sum-of-patches-with [pc = green or pc = blue] [density] returns the sum of the densities of all patches which are blue or green.

Notes:
This command can also be executed by patches, for example within an ask-patches statement.

Related Commands:
average-of-patches-with max-of-patches-with median-of-patches-with min-of-patches-with mode-of-patches-with sdev-of-patches-with sum-of-patches variance-of-patches-with