|
|
新手发问超简单问题,目前还处于研读范例码的阶段,边测边看结果来理解程序
" ?# V) ?$ h1 B其中有一段如下
/ w7 x) X# ^7 l; P3 V# @2 S: yask turtles with [ infected? = true ] 4 a: g/ ^2 {" Y0 X2 ^
我原本以为这句会回传『所有』infected? = true 的 turtle. q! |* P: K7 d) Z
但看结果似乎不是这样。) L$ U9 S z7 M5 Q3 v
, z8 d6 f* r% B+ M. P, t
假设所有符合条件的有 5 笔( b9 v# r( Y& R
有时候回传 1 笔,有时回传 3 笔,是不固定的
& U6 _+ ?3 g2 c/ C回头查语法定义& o6 x! h* ~. C8 g: K8 F) y9 f r
with
. ]- Z. Z/ F9 q8 v& |6 tagentset with [reporter], c: w" [: B, H# b8 {+ d4 R! t
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.( B8 Y' A+ a# {8 T$ M6 A2 A
它只说回传 agents satisfying the given condition8 ^2 z' U8 Y# s8 I/ P/ l4 D/ C' N
是否 with 回传的是『符合条件』的数据,而不是『所有符合条件』的数据 ?
' P! g+ M4 k$ B! y1 B; j+ h; [
4 ^& m" z. |. K& l! _想确定一下
' X6 e P6 ] `谢谢!. Y/ S$ X2 ?+ B
|
|