|
新手发问超简单问题,目前还处于研读范例码的阶段,边测边看结果来理解程序
) `* K0 N. c9 T5 h) E+ }! F其中有一段如下( S! t/ o! n: E
ask turtles with [ infected? = true ] # q. [* {: `) i% N! } U
我原本以为这句会回传『所有』infected? = true 的 turtle
+ _) w( K( M- R但看结果似乎不是这样。
& u' D; |* |4 p2 ^
( S9 v$ q; C! G; R0 x( ]假设所有符合条件的有 5 笔
& g( D4 m5 n9 w+ R, K5 ~2 N有时候回传 1 笔,有时回传 3 笔,是不固定的
3 I- s' q# Z0 b回头查语法定义7 d3 l) n5 c- S3 J) Q* n5 r# k/ z
with
: L; \4 x) X# nagentset with [reporter]
1 L# k( F1 e/ C; y) U1 X z, CTakes 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.0 I$ N! x1 j& k2 W2 `
它只说回传 agents satisfying the given condition% E/ A; r& w. u0 K' b/ i: K
是否 with 回传的是『符合条件』的数据,而不是『所有符合条件』的数据 ? - d& W& T+ |2 J& _7 P$ s/ R
1 R, N* E; w V3 S3 e( @
想确定一下
. T2 f7 \! T8 E; A' v4 n9 e谢谢!
9 X* h$ l: h2 b& |! P) t/ u |
|