|
|
新手发问超简单问题,目前还处于研读范例码的阶段,边测边看结果来理解程序
4 }9 H5 z: I" ^1 f! ?其中有一段如下
: S" W5 D; C8 M; f3 r! `+ lask turtles with [ infected? = true ]
$ l3 ~ G1 q D, l, x! i我原本以为这句会回传『所有』infected? = true 的 turtle
: l4 t2 p; E! y0 y$ K; s: u% a" k但看结果似乎不是这样。# p+ \3 C! w i- p7 x
, e; J* a0 s( Z- j" g假设所有符合条件的有 5 笔
* a! y, d; g& s2 R8 h有时候回传 1 笔,有时回传 3 笔,是不固定的$ R3 y$ K3 [4 h( @4 O3 l: T
回头查语法定义3 t+ W1 ~. @9 `: W; z
with
# x0 Z& Z9 d1 F" i" P! kagentset with [reporter]
* P0 T' z" d 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.$ C! a, v r4 o+ z) A; d: Z
它只说回传 agents satisfying the given condition3 R( n+ a+ [1 S# M+ \) t
是否 with 回传的是『符合条件』的数据,而不是『所有符合条件』的数据 ?
8 k- P( q5 b) T8 W/ T
. B' t0 s* O4 e" b. P想确定一下
x/ r1 y! W O- `$ q谢谢!
3 G+ T& k9 j! `) R2 f. a. q) p |
|