|
|
新手发问超简单问题,目前还处于研读范例码的阶段,边测边看结果来理解程序
1 g8 y! H% X2 n5 u其中有一段如下
. R: d a. X ?) J+ Gask turtles with [ infected? = true ]
5 ]& c, \2 B& {7 f9 K我原本以为这句会回传『所有』infected? = true 的 turtle
% k5 x# x4 J* m) v6 T& C但看结果似乎不是这样。
2 j9 k: O$ o" ^( X/ u) q6 d4 |- r, ?/ J& U7 \& @
假设所有符合条件的有 5 笔" }+ V: \- W- }6 e
有时候回传 1 笔,有时回传 3 笔,是不固定的
3 p# y3 @ d8 k+ s* L回头查语法定义" C% I9 X8 ]* _/ z% r" Q
with
* a: D; P7 ~$ ~' \. n8 ^# q2 T, pagentset with [reporter]
: r/ k/ I3 \" {: j z# VTakes 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.
( [8 A5 {2 q# Y8 y0 x它只说回传 agents satisfying the given condition$ C3 R- k% c( j7 F! i$ k8 b
是否 with 回传的是『符合条件』的数据,而不是『所有符合条件』的数据 ? \+ e3 L% Z2 T/ o$ L' T x
: t! |' ]. C9 c1 L3 C想确定一下
, [$ F" x; t" f- x: w, K谢谢!
4 o- c3 S d9 f! F0 N |
|