|
|
新手发问超简单问题,目前还处于研读范例码的阶段,边测边看结果来理解程序. }; [1 E' |8 }4 M% v2 Y) D
其中有一段如下
7 `/ i; y2 G+ T1 L# q% W; Gask turtles with [ infected? = true ] 9 }) z; K9 O' R$ P4 G; Z. f
我原本以为这句会回传『所有』infected? = true 的 turtle( J |( e; |6 s; A0 X' H
但看结果似乎不是这样。$ a6 |4 G b) ~- i
* T3 S8 `2 f- V! P
假设所有符合条件的有 5 笔0 s3 ~- S; B2 ^) G
有时候回传 1 笔,有时回传 3 笔,是不固定的
% A6 i1 ^$ r0 h回头查语法定义
/ J+ t' Z# @" d0 nwith
* _0 x3 x, R+ n% z& F0 S3 E& Dagentset with [reporter]
' q: g4 h0 \. a/ V. Y, qTakes 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.1 y4 }+ F* @' ^/ p
它只说回传 agents satisfying the given condition/ x, c$ H* m* b: F6 y- e
是否 with 回传的是『符合条件』的数据,而不是『所有符合条件』的数据 ? 8 O- {. _" u' r9 `5 E
. ^( }) U/ M' |想确定一下
- B( H" _7 L/ Y! ]/ r: h谢谢!* m/ }9 Q1 A k9 i+ s! C
|
|