|
|
新手发问超简单问题,目前还处于研读范例码的阶段,边测边看结果来理解程序$ d+ a* w1 M% J3 i" `/ ~' m
其中有一段如下
: P0 D) q% o1 O6 q: u! V4 mask turtles with [ infected? = true ]
0 z" n6 B- c7 ], Z' {5 ?我原本以为这句会回传『所有』infected? = true 的 turtle9 z7 |6 K) j L0 p: m; ?, y1 o) A
但看结果似乎不是这样。
; q" z0 z V2 d5 ~3 d; N1 t0 |# T
) ^! O& F- m6 O G假设所有符合条件的有 5 笔8 w* q8 s7 I- C. U: \, A U4 g
有时候回传 1 笔,有时回传 3 笔,是不固定的
: {9 N' h8 T& @, y* N回头查语法定义- e0 z$ W" E9 r2 D/ X
with , Y$ n3 \/ g) ]( U: E$ W
agentset with [reporter]
7 i: O9 ?5 y9 \6 O2 s8 {) gTakes 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.
& Q5 p/ ^- X3 \. ~' D它只说回传 agents satisfying the given condition" W5 _# c1 J% |9 J, g& C
是否 with 回传的是『符合条件』的数据,而不是『所有符合条件』的数据 ?
0 Q* J5 V( N- b' J7 a) P- P
7 L. I+ |) \' T; T$ I4 x, v9 w想确定一下( h' b$ u# f( k2 f
谢谢!. A7 z+ r( j4 o( b
|
|