|
新手发问超简单问题,目前还处于研读范例码的阶段,边测边看结果来理解程序. i* P, s+ H- t2 a' u8 B$ ~
其中有一段如下
R% N. @# ~6 B+ {1 r8 f* Wask turtles with [ infected? = true ] ! \$ K1 Q, {5 \4 c: c, b
我原本以为这句会回传『所有』infected? = true 的 turtle( J S/ q; C* {$ ], W! C1 c
但看结果似乎不是这样。3 Q7 j" Y+ |. x
9 |/ \8 G% O8 G& }* \
假设所有符合条件的有 5 笔
8 D% F$ f9 S& E' }2 ]$ J; E有时候回传 1 笔,有时回传 3 笔,是不固定的
3 a s: f$ U4 f: g! T. P回头查语法定义
0 r$ o3 ]4 u9 Twith
$ G7 N# [& c5 i6 B& Vagentset with [reporter], F7 X8 p$ L* ~( c( Y
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 w% N+ R: k! m9 U9 c
它只说回传 agents satisfying the given condition
; S+ N6 Q! }, c; ?9 Y& K是否 with 回传的是『符合条件』的数据,而不是『所有符合条件』的数据 ?
3 F1 S5 O1 T2 D" H* j4 J2 o$ _9 N1 `4 s9 A( r: q! h6 ^5 ^
想确定一下9 B! w1 {8 O' U" y4 `
谢谢!" ]4 D: e- u2 z6 M
|
|