|
|
新手发问超简单问题,目前还处于研读范例码的阶段,边测边看结果来理解程序
0 |5 S" R6 o. m- I9 B其中有一段如下
. E. e1 u2 a; c3 _) rask turtles with [ infected? = true ] % B4 t4 ^& m; O" K5 M6 p
我原本以为这句会回传『所有』infected? = true 的 turtle
) i8 @3 e5 K3 d但看结果似乎不是这样。' p# c2 t4 p# y$ R. e
9 L A# I; S: @! R1 L) d假设所有符合条件的有 5 笔
0 a" }* L& n5 }有时候回传 1 笔,有时回传 3 笔,是不固定的
& `! y; g( B/ n# V/ V回头查语法定义
) c" c" i* R( Q! Twith
3 l5 x0 w7 |/ u5 l$ c9 q8 cagentset with [reporter]/ Z2 j7 X" o- |6 e' p7 e
Takes 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 f* ~ s- @4 g4 `它只说回传 agents satisfying the given condition
8 a$ Y$ J: g! k2 y" |是否 with 回传的是『符合条件』的数据,而不是『所有符合条件』的数据 ? / X/ {7 g ~6 i
" \ {8 J& M' J1 W1 I
想确定一下5 w& |& S! t3 E: g, d
谢谢!1 f( {8 q0 P$ [5 G
|
|