|
新手发问超简单问题,目前还处于研读范例码的阶段,边测边看结果来理解程序
* w( _. |0 m) i8 Q其中有一段如下
- l/ S, C1 g* a' ?9 B0 e- Task turtles with [ infected? = true ]
: } L1 S( x; G# j我原本以为这句会回传『所有』infected? = true 的 turtle) d% G: b5 Q' |% b P
但看结果似乎不是这样。' X5 m3 W4 ]; {
; c" p$ ]' C+ |7 S假设所有符合条件的有 5 笔
* I2 Z! o2 i x: c2 n有时候回传 1 笔,有时回传 3 笔,是不固定的
$ g9 R+ Z. G+ o6 \, e回头查语法定义* V' ?1 n, \; y: @4 w
with , F ?$ I# c9 V+ r4 b9 J9 }9 _( o
agentset with [reporter]/ K3 Y7 F$ ? y9 B
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.
% D( N/ ^! }2 i; E0 Z! A它只说回传 agents satisfying the given condition" l) D8 [. H# Z6 M) s
是否 with 回传的是『符合条件』的数据,而不是『所有符合条件』的数据 ? ; t1 h0 G) \% [ I4 `
% m. \3 \' S4 p
想确定一下/ T0 q8 X' p @2 q6 k; Y$ J
谢谢!
: S' H% S/ K8 D. a+ y+ R |
|