|
|
新手发问超简单问题,目前还处于研读范例码的阶段,边测边看结果来理解程序8 E$ _) w( p' z# j) k
其中有一段如下
. s5 ]3 e4 T$ E5 _0 E2 \ask turtles with [ infected? = true ]
2 ^. v9 d" T! {8 D: y% i' Z4 h我原本以为这句会回传『所有』infected? = true 的 turtle$ A- L' C6 \. R
但看结果似乎不是这样。
$ Y9 b- Q( V- }) o* Y, j! M" W
2 c) M% b8 H/ C& I; ]4 }, y假设所有符合条件的有 5 笔
0 _8 u0 ? i& ^/ j( H5 C5 o! P& W3 ?有时候回传 1 笔,有时回传 3 笔,是不固定的
; p V5 J' N2 u6 J- F* [回头查语法定义
# y. |5 {6 q( z j* N4 A h' dwith
( S6 S+ [- l3 ~8 [$ D9 G% y5 iagentset with [reporter]' N& d; T: w: s2 Q2 B; r
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.
, W r# g" X1 b* K G; F它只说回传 agents satisfying the given condition! n/ q7 x! j* x) i- H$ n8 w
是否 with 回传的是『符合条件』的数据,而不是『所有符合条件』的数据 ?
8 m: A2 E9 Y0 u2 O8 L; H% E( A
+ q% [2 t: p5 S3 m想确定一下, W+ D/ e+ B8 A" ?6 e) ^8 b
谢谢!/ |) n. x! i" j
|
|