filter1.3

filter reporter list

Reports a list containing only those items of list for which the reporter reports true -- in other words, the items satisfying the given condition. reporter may be an anonymous reporter or the name of a reporter.

show filter is-number? [1 "2" 3]
=> [1 3]
show filter [ i -> i < 3 ] [1 3 2]
=> [1 2]
show filter [ s -> first s != "t" ] ["hi" "there" "everyone"]
=> ["hi" "everyone"]

See also map, reduce, -> (anonymous procedure).

Take me to the full NetLogo Dictionary