|
|
新手发问超简单问题,目前还处于研读范例码的阶段,边测边看结果来理解程序5 g" H' f, _- ?- W+ w6 k. m
其中有一段如下
{; L9 S' J& M$ V/ K/ m: bask turtles with [ infected? = true ] , H# d, b3 ^: }( R/ V9 T; J4 g4 Y
我原本以为这句会回传『所有』infected? = true 的 turtle
3 o& b, N \* U: j" @但看结果似乎不是这样。
3 j/ x5 ?/ y' G0 g% s6 r+ @! y, a
1 F% } Q' ?4 c! F- j假设所有符合条件的有 5 笔
: A$ z, n2 M3 o) c有时候回传 1 笔,有时回传 3 笔,是不固定的
( y: {/ J2 N5 G& B; t回头查语法定义' M& s4 f0 j' h3 m; ~, q9 V8 ~2 c
with
% n6 d% j* g* P, vagentset with [reporter]
3 N2 ~0 [: Q' X- @( iTakes 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.
- S1 Z. l j$ k它只说回传 agents satisfying the given condition
0 a8 _8 k" v6 X, ]是否 with 回传的是『符合条件』的数据,而不是『所有符合条件』的数据 ? " U1 n) O% r! ~
* t4 L9 ^1 _! n8 W8 v: r
想确定一下. I4 E, m" S4 D% j+ K' T* U' t
谢谢!
U( ~ ]# z6 T. { |
|