|
|
新手发问超简单问题,目前还处于研读范例码的阶段,边测边看结果来理解程序; f- u$ d) d+ P) K6 \
其中有一段如下
. U4 z8 `. u0 x- ~$ gask turtles with [ infected? = true ]
0 {* A. F9 G9 f/ w我原本以为这句会回传『所有』infected? = true 的 turtle
0 l; g( b( Q" ^! G但看结果似乎不是这样。
) R l( A7 P# x
5 A. ~2 k' c4 T+ S" r" [( i假设所有符合条件的有 5 笔
/ `4 C u5 B, g R1 V/ b' h有时候回传 1 笔,有时回传 3 笔,是不固定的
8 J# z0 o1 y0 U3 Q回头查语法定义 O4 f0 B- D4 D+ Z6 w% X$ J' s5 u0 X
with
' n8 J" r& ]7 C! C% {agentset with [reporter]
& w* }( k5 V- U' O# M' ETakes 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.. G5 P1 t7 j$ S# z8 [6 R
它只说回传 agents satisfying the given condition6 H0 V3 D& P) z1 I% S
是否 with 回传的是『符合条件』的数据,而不是『所有符合条件』的数据 ?
/ X! P0 ?7 g3 a2 F J& X# h$ I
2 s+ A( @; I) t2 y: a' a想确定一下
M* v0 X( U& P, R6 Z& s. t谢谢!
) Z& h+ b7 I- c8 D8 I f |
|