|
|
新手发问超简单问题,目前还处于研读范例码的阶段,边测边看结果来理解程序/ G: ~; ^+ m) L- b
其中有一段如下
- U% Y; W- Z- U0 Fask turtles with [ infected? = true ] % x1 ]' j/ G3 D" B7 P8 c* P
我原本以为这句会回传『所有』infected? = true 的 turtle1 ^, x+ r% \) _- J
但看结果似乎不是这样。0 X7 w# D5 h5 J/ Q9 k
( O( A) y, R- h1 C
假设所有符合条件的有 5 笔
8 }) W8 x F8 b/ W( b/ A4 P有时候回传 1 笔,有时回传 3 笔,是不固定的; I3 d/ P3 r( K$ ?1 i# Z
回头查语法定义
! V1 N$ W$ Z. I' \3 y0 L( hwith 3 i7 @: V! S w/ V6 V
agentset with [reporter]
* Z; u+ w6 R" n: m8 fTakes 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.
+ {* f9 V4 G: D9 ]它只说回传 agents satisfying the given condition
- D) X; e) ~- }9 Q z是否 with 回传的是『符合条件』的数据,而不是『所有符合条件』的数据 ?
. R8 d0 x' t- O& j: _ @8 K% _: d/ x( h4 k1 r. c0 Q
想确定一下" B' F) P0 R4 P0 b( t$ n1 L% l
谢谢!8 |: p1 H K- k, N& R) M
|
|