|
|
新手发问超简单问题,目前还处于研读范例码的阶段,边测边看结果来理解程序
" y" R* w- j9 b: k其中有一段如下
I) i* Y3 W) E" wask turtles with [ infected? = true ]
, [3 ~6 M0 W( o; |! h) x我原本以为这句会回传『所有』infected? = true 的 turtle
+ z- k$ ~9 Y, G0 ]7 C但看结果似乎不是这样。
3 A2 j+ P/ ^" d# V4 o0 c5 Y4 {
/ I7 H# P# v, i0 L' v4 O假设所有符合条件的有 5 笔
) m) i; r. t, h0 |& T/ Y有时候回传 1 笔,有时回传 3 笔,是不固定的
2 v* z7 q1 C' V6 n1 b回头查语法定义$ `! W$ Y- [: @0 ^
with
3 w/ F" J9 h0 X1 c& N; Y" aagentset with [reporter]8 N5 n8 g$ v1 f* j& p+ j1 f' I
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.! K/ `% z2 l4 B8 N; j8 H
它只说回传 agents satisfying the given condition0 N$ S2 K( K: L! v$ A
是否 with 回传的是『符合条件』的数据,而不是『所有符合条件』的数据 ?
) z( n: N2 x9 @0 i( C" V6 i- P% y5 j( B0 C+ W
想确定一下
) H5 w- B; v! x7 Y6 a8 G谢谢!% f# \) e5 f" y- _6 V) d$ a, Q7 X
|
|