|
|
新手发问超简单问题,目前还处于研读范例码的阶段,边测边看结果来理解程序
5 ? ^4 V; ]1 @* Y+ H: c U其中有一段如下
7 @) g6 u# j& J2 V) qask turtles with [ infected? = true ] ( a6 I1 [0 K" c% D) ^
我原本以为这句会回传『所有』infected? = true 的 turtle
& x- S! u/ s! _' @5 C# \但看结果似乎不是这样。
! r$ q' x' e) j- y9 J& s
+ W2 _# E6 ]9 n4 b假设所有符合条件的有 5 笔7 D, L- s7 @, Y% }
有时候回传 1 笔,有时回传 3 笔,是不固定的
3 w% o' ^# ]7 V( g回头查语法定义0 @# p# z# D$ i& }$ J
with
# Z7 [7 P# D0 A# j5 ragentset with [reporter], P+ S2 ~3 S- ?& Q
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./ ?! `; t7 k8 d; I2 C
它只说回传 agents satisfying the given condition4 M: E3 T* j: ?1 t' s3 A S
是否 with 回传的是『符合条件』的数据,而不是『所有符合条件』的数据 ? 1 f X0 i; h' J2 O& J& `7 V* g
* j0 B# ^8 I) [: Q
想确定一下
3 t* Y1 L- B+ o. w. g4 i谢谢!7 |& Q0 v2 }( G
|
|