|
|
新手发问超简单问题,目前还处于研读范例码的阶段,边测边看结果来理解程序; m1 C M8 s* R' X8 }* {& E
其中有一段如下
' A3 {, u; u" lask turtles with [ infected? = true ] : Y/ G5 M# F# k3 ~
我原本以为这句会回传『所有』infected? = true 的 turtle0 U% X3 y- u+ O9 I' M/ m
但看结果似乎不是这样。5 m; A3 x4 ~/ |! B8 t
7 h1 P, F$ i) m$ a假设所有符合条件的有 5 笔
1 a% j+ C. s5 F2 V有时候回传 1 笔,有时回传 3 笔,是不固定的2 k2 z6 x. z2 U& I6 _; Y3 e
回头查语法定义
5 [- N, F* u& B4 |+ C9 F6 @with
1 q' `' U8 H5 \3 C# Z* m: o( z; |agentset with [reporter]
D/ w; Z* @& wTakes 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.
, z# U2 B( J) c* J/ E" l它只说回传 agents satisfying the given condition
" c8 M) u8 i% h: i, E是否 with 回传的是『符合条件』的数据,而不是『所有符合条件』的数据 ?
9 e' m) w: W8 S) c8 V. z9 d+ W
4 b* t; Y/ f. d% J$ P, x想确定一下
0 Q o6 K* J( M5 W谢谢!$ m; o. ^9 C+ U" M& d Y
|
|