|
|
新手发问超简单问题,目前还处于研读范例码的阶段,边测边看结果来理解程序4 D( }+ g8 U- C9 e z% i
其中有一段如下
5 w& `$ P+ w! d, a& }+ Uask turtles with [ infected? = true ] 6 p/ }& H& k$ Q0 P v$ _
我原本以为这句会回传『所有』infected? = true 的 turtle
. Q4 U5 ~3 t0 `0 [但看结果似乎不是这样。
7 a: s7 {, O5 v; \/ d$ r* X* E2 }/ H: ^6 n
假设所有符合条件的有 5 笔1 ^. k. A2 R1 K. m$ c0 e
有时候回传 1 笔,有时回传 3 笔,是不固定的
) T, y0 Z( f0 G4 O+ @回头查语法定义0 ?( |) m1 l! h t
with
: ` q3 h- E/ N# T- E% Zagentset with [reporter]
4 N, B% M6 c* w6 ~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.7 Y/ ^: |6 q1 A1 l+ j
它只说回传 agents satisfying the given condition
' t/ W* u/ c' Y6 Y7 N5 N# q是否 with 回传的是『符合条件』的数据,而不是『所有符合条件』的数据 ? ( K. N- k, L& I! ? G
0 D* D( B T5 K. S. S0 I5 Q$ k* Y想确定一下
$ p' P; N1 R. G9 m# s谢谢!
# Z$ i' ~. v1 \ |
|