|
|
新手发问超简单问题,目前还处于研读范例码的阶段,边测边看结果来理解程序
9 W" f' L( A$ k7 E4 c其中有一段如下
5 }9 ?6 _9 Y/ j5 `/ Z* j6 m T2 sask turtles with [ infected? = true ] 7 A" z. N/ f. b; r, g1 X# v" L
我原本以为这句会回传『所有』infected? = true 的 turtle/ e- R( m' ]8 p8 o6 I
但看结果似乎不是这样。
1 d% i: \. @/ d
x9 h; b2 G+ p2 P+ s( u假设所有符合条件的有 5 笔
& a F2 w j' X6 o' \) ]: G: ? T有时候回传 1 笔,有时回传 3 笔,是不固定的
# Z1 j+ _5 c8 b! `6 w" I回头查语法定义
' r. g; g, t7 j2 V [. Ywith
8 d( U2 u& N1 a- d& I& u0 uagentset with [reporter]
T& I. B" K& A1 mTakes 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.5 Z0 K- F+ S' g$ B* r- O
它只说回传 agents satisfying the given condition& f( _ ?: v0 _3 d9 B
是否 with 回传的是『符合条件』的数据,而不是『所有符合条件』的数据 ?
1 X+ S8 \5 X4 a( }8 @
4 S2 _8 D3 a6 j. ^3 F8 a& }5 ?8 c% e想确定一下
0 x$ V2 K; M6 ~: E7 _8 {谢谢!
8 \5 \4 N$ q& s1 \ |
|