|
|
新手发问超简单问题,目前还处于研读范例码的阶段,边测边看结果来理解程序
; {5 g9 W2 G* e# I* r其中有一段如下
. [8 B5 W) Q5 Bask turtles with [ infected? = true ] ' ~: S" r# ]3 a5 e- B
我原本以为这句会回传『所有』infected? = true 的 turtle0 |' P6 X# O" q
但看结果似乎不是这样。
/ ^3 i. P# ?3 Z+ g7 G6 ?% [
9 |6 g9 m1 x: G/ d( t假设所有符合条件的有 5 笔
* _" M/ }% ?( O3 K+ ? Q$ v有时候回传 1 笔,有时回传 3 笔,是不固定的
. H( H! v( G) c1 }% x: w4 E+ Z回头查语法定义
5 |: K8 R% N. b; z" G+ K3 gwith
3 H) F: e8 p' zagentset with [reporter]
) H9 L, r/ c/ A7 J9 m) |4 ?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.
: c: h6 O4 |/ Y1 R8 x它只说回传 agents satisfying the given condition( d7 p9 k6 Z+ E6 S o8 W7 U2 J1 c; [
是否 with 回传的是『符合条件』的数据,而不是『所有符合条件』的数据 ?
, L- ]" [. Q! U
- L/ _- f' j# J* P& q% ~4 Q+ F想确定一下
, E& ~) z, t1 F( h# x谢谢!
/ b8 J* Z& e; _( s3 j |
|