|
|
新手发问超简单问题,目前还处于研读范例码的阶段,边测边看结果来理解程序4 E/ u$ B$ i- w8 d
其中有一段如下
8 k2 J' A1 r& ?! ^; e0 nask turtles with [ infected? = true ] / E( x+ b' i' q' o
我原本以为这句会回传『所有』infected? = true 的 turtle8 x7 y }. O) h
但看结果似乎不是这样。
5 H# N' U* }3 Z! T% Y, y, J7 k R) c) D1 W
假设所有符合条件的有 5 笔9 v( M: M" D# S) T( Q; W& [. b
有时候回传 1 笔,有时回传 3 笔,是不固定的' Z2 a+ a# C# v# W& t9 @4 g7 a
回头查语法定义
" U2 G1 Y8 j/ Fwith
) R" x9 L7 k& n0 x% h! _% X. vagentset with [reporter]: ^! j, z2 C+ {' b$ `$ N$ P2 E
Takes two inputs: on the left, an agentset (usually "turtles" or "patches"). On the right, a boolean reporter. Reports a new agentset containing only those agents that reported true -- in other words, the agents satisfying the given condition.
4 l, D c( l/ _6 a& D, B它只说回传 agents satisfying the given condition
, @' B" S# H+ x$ E: f是否 with 回传的是『符合条件』的数据,而不是『所有符合条件』的数据 ? 2 w9 }/ m2 F% Z- c- R* {
2 ?) W4 R- b6 h& V想确定一下
: Z3 w! X$ @6 Y& y谢谢!
p( x+ U. ~9 D7 C5 C+ a# p& n |
|