|
|
新手发问超简单问题,目前还处于研读范例码的阶段,边测边看结果来理解程序: Q, x. z; o% w
其中有一段如下
! G, \ n: v9 Qask turtles with [ infected? = true ] % @" e: S( w! x' S- _
我原本以为这句会回传『所有』infected? = true 的 turtle( B* n5 t$ J2 O+ `/ o
但看结果似乎不是这样。: G, p/ b6 _6 w! S) v/ L. g9 f
9 J2 B3 L2 o1 v2 M- }假设所有符合条件的有 5 笔1 a9 J0 J) j8 O, r2 [
有时候回传 1 笔,有时回传 3 笔,是不固定的. |4 Q! k9 ]8 R7 J
回头查语法定义
8 T( ~3 v$ ~2 B+ |& z- r" G- p/ m* s6 Owith
- v' i8 u0 j6 Xagentset with [reporter]
4 q5 C8 _4 ?9 M# V% z9 k3 eTakes 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.- Z3 ^8 O) J8 P5 s
它只说回传 agents satisfying the given condition5 d3 q5 b5 x: d8 }+ }& A( |
是否 with 回传的是『符合条件』的数据,而不是『所有符合条件』的数据 ?
- H% G. z2 v0 J% c! K
# `# l" y& f' w1 ^想确定一下1 D) K9 _4 ~) [: y
谢谢!! q* q& U1 y4 }/ y6 {! Z9 d1 c' w
|
|