|
新手发问超简单问题,目前还处于研读范例码的阶段,边测边看结果来理解程序
* {- ?( q; E, f& j$ b; Y其中有一段如下
3 G6 y/ d; |8 J Xask turtles with [ infected? = true ] 0 @. H6 V9 a# P* J
我原本以为这句会回传『所有』infected? = true 的 turtle
0 ?% X. v( F. O但看结果似乎不是这样。
3 q. Y! T3 q- O
* m0 w) t( d p# V假设所有符合条件的有 5 笔
! Q+ x6 D+ [4 p- U8 ~/ u f5 A有时候回传 1 笔,有时回传 3 笔,是不固定的
' M* _3 |: L& c- ]! E回头查语法定义. O8 o4 W4 H& x
with
$ e# h& V ]6 Q$ k- P0 oagentset with [reporter]
: D7 v4 @/ U, r1 mTakes 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.5 i! d+ e8 ^3 B" P+ f. }
它只说回传 agents satisfying the given condition( q/ ]& J: Q4 n
是否 with 回传的是『符合条件』的数据,而不是『所有符合条件』的数据 ? 4 ]# e, c8 d: m6 |4 Q
: S: X( i3 @ l# \/ e j( E想确定一下
% a: a% X9 Y6 s) e) u A5 l7 ^谢谢!
$ c8 q3 U$ t% [5 W8 \: F5 A |
|