|
|
新手发问超简单问题,目前还处于研读范例码的阶段,边测边看结果来理解程序* Z" S Q! {( \5 n
其中有一段如下
% X% V9 h- C) r2 q, Yask turtles with [ infected? = true ] - z5 V2 H' a& @( R8 T i7 }7 T. Y
我原本以为这句会回传『所有』infected? = true 的 turtle8 V3 {: T, C6 b# ?+ t
但看结果似乎不是这样。
6 k3 a# Z" e2 q {, }
4 @- Q0 g. \$ e# W假设所有符合条件的有 5 笔
C* a0 T/ X: A( \0 y3 n1 v有时候回传 1 笔,有时回传 3 笔,是不固定的; s* \! J5 k/ S$ a- y ^, k
回头查语法定义
% k* q" a* E3 ] l- o( w& o" M& \with 7 x' P4 u: W2 P1 b# _4 \! L
agentset with [reporter]( @$ _9 Z+ r) I! r( 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.
3 E4 |! F! B0 H' ~- `7 ^/ f1 R它只说回传 agents satisfying the given condition
# U- l V, d N是否 with 回传的是『符合条件』的数据,而不是『所有符合条件』的数据 ? " E2 K% q) n# W' w* r
& D3 q3 o+ [7 E: h! k. D想确定一下: a( a5 {& V& [; [ s4 O
谢谢!" e8 y9 q* z$ X3 D
|
|