|
|
新手发问超简单问题,目前还处于研读范例码的阶段,边测边看结果来理解程序* x6 R) Q/ V# y! K
其中有一段如下
0 x2 f+ U8 T9 G# G2 F% O. U3 uask turtles with [ infected? = true ]
o* s' V# \% m! C" d; P. `% F我原本以为这句会回传『所有』infected? = true 的 turtle. H& l* r( ?* P0 I5 M
但看结果似乎不是这样。
( R' p) Z. N* k, x0 `+ `7 m7 U9 z3 v R% K
假设所有符合条件的有 5 笔
* j( d1 m8 j8 Q' q( x% X5 Y有时候回传 1 笔,有时回传 3 笔,是不固定的
) ?9 L$ n% { Z" N7 F# ~* d回头查语法定义4 k% V2 q& Q4 B! Z/ I$ L" @
with
: s6 e% L# c4 h$ H* i0 b ^agentset with [reporter]
5 c; w2 u2 C+ I s4 {7 y% KTakes 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.! r. m$ I$ L3 |6 f0 I8 p7 ^
它只说回传 agents satisfying the given condition
4 \- E3 v9 _2 j! a是否 with 回传的是『符合条件』的数据,而不是『所有符合条件』的数据 ? 2 |* ?' H, E( r9 V8 V
( f2 @6 T* N' p2 D2 t/ Q# l
想确定一下/ o) S8 m6 @& Y1 `1 h
谢谢!) T* n9 f' o0 M m
|
|