|
|
新手发问超简单问题,目前还处于研读范例码的阶段,边测边看结果来理解程序; k; Q9 ~+ B( R+ K: K3 D# Z4 r c& t
其中有一段如下
r. t+ L4 f: ?+ E: b& c% ^" i" G, wask turtles with [ infected? = true ]
0 u# h4 S4 A, W$ D3 ?+ M) v" T我原本以为这句会回传『所有』infected? = true 的 turtle
' o# n: G1 |- H: D$ K但看结果似乎不是这样。* I2 R' O/ }3 ]& u7 I
1 B1 e9 t6 q5 d: g4 W2 q6 Q
假设所有符合条件的有 5 笔% v8 w7 o9 M$ k1 h
有时候回传 1 笔,有时回传 3 笔,是不固定的& |5 p6 t) n' v0 S7 i5 t2 f. m
回头查语法定义 g( b) M' w/ ~: m3 M, E+ m
with
5 A$ q+ c- V3 i1 _; ]0 r9 v+ dagentset with [reporter]
3 W, I2 `6 n$ q0 n4 S. GTakes 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.
" c! G0 D+ D3 x它只说回传 agents satisfying the given condition
" O5 u: h7 ~% X) D$ e9 W是否 with 回传的是『符合条件』的数据,而不是『所有符合条件』的数据 ?
4 X& a8 V3 I8 ?* A: ^( \6 E8 s. X+ Y+ v4 L: R( @
想确定一下
! X1 E$ K, J+ j2 e) I9 u谢谢!: u9 |. L1 S3 Y
|
|