|
|
新手发问超简单问题,目前还处于研读范例码的阶段,边测边看结果来理解程序8 P) [. n! p9 H) R
其中有一段如下
2 ?1 I. E; b) e, Bask turtles with [ infected? = true ] ( v# d. I( L- w8 Q
我原本以为这句会回传『所有』infected? = true 的 turtle; \# S( G8 c5 a; g
但看结果似乎不是这样。9 S' O, p. x! Y! F: F
& w) o# x! j- `) E, r假设所有符合条件的有 5 笔
% g+ {; y: a0 V, e) x# D6 e7 j+ [有时候回传 1 笔,有时回传 3 笔,是不固定的
3 q1 K* q* s3 G$ L回头查语法定义0 j. h6 I5 |. H4 S9 z% P
with
# O. X- M# x$ _0 f9 J% O3 Vagentset with [reporter]
9 {2 }/ 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.+ `2 {" T8 Q, _
它只说回传 agents satisfying the given condition3 }* C8 @! f& ^* v3 b: m
是否 with 回传的是『符合条件』的数据,而不是『所有符合条件』的数据 ?
# b, k2 _& ]6 V3 Z. @ s Y% O) J" n3 @
想确定一下# k& H8 b' j2 j* [5 V
谢谢!2 a( @5 H3 y+ s, \* F2 m1 r) k
|
|