|
|
新手发问超简单问题,目前还处于研读范例码的阶段,边测边看结果来理解程序
7 z4 ^$ i6 `* k1 D9 O( z其中有一段如下
; @. v( z; Z' m( H- Y7 a0 f$ uask turtles with [ infected? = true ] ) v% d3 i! ~* d" n4 Z
我原本以为这句会回传『所有』infected? = true 的 turtle& e% U1 f, X) r
但看结果似乎不是这样。
; p/ |& R; I) f; B7 V8 Q. W
* T7 N* x& y0 o; [. h8 a假设所有符合条件的有 5 笔0 U1 w4 w, ?( @: C# b4 t
有时候回传 1 笔,有时回传 3 笔,是不固定的
/ s4 r- t2 [# g* s* W回头查语法定义
8 N) Z% c9 i |* D: V9 Owith
: P1 L3 S# Y/ o" _) e9 M/ tagentset with [reporter]
[' V# n! |5 B7 P2 @0 DTakes 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.
- f N! G& f. ]4 o( Y它只说回传 agents satisfying the given condition, @5 V9 |3 F7 j5 ?/ h ?
是否 with 回传的是『符合条件』的数据,而不是『所有符合条件』的数据 ? : b* S) g/ d3 ?
. W( G- G, g0 B
想确定一下+ ?- r: P) g) f4 V
谢谢!
7 Z: X+ o( I5 a7 ? |
|