|
|
新手发问超简单问题,目前还处于研读范例码的阶段,边测边看结果来理解程序- c; P$ [8 B. i B$ g3 N) V
其中有一段如下
1 v, e4 T) B; c; c( L4 s% Bask turtles with [ infected? = true ] " b1 v7 ^$ w* J
我原本以为这句会回传『所有』infected? = true 的 turtle
6 X2 z6 d9 H/ N0 O7 f |但看结果似乎不是这样。
8 F1 s. k+ C6 |$ d" C# u* h4 D9 A( ]1 Z8 \7 q# M
假设所有符合条件的有 5 笔* h/ g( `1 q1 V* G
有时候回传 1 笔,有时回传 3 笔,是不固定的; ?/ {9 B. y7 }8 B# q
回头查语法定义8 v* F: c/ t# e, `5 @) g( w# I
with
# K' ~# V7 p0 z6 Z6 Bagentset with [reporter]
$ E+ s0 H" M1 ?6 Z: D4 b2 |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.
& t: _0 G+ ]3 G9 A) ^它只说回传 agents satisfying the given condition) E6 m7 _' ?. \. C9 E Z9 j0 c& l' R
是否 with 回传的是『符合条件』的数据,而不是『所有符合条件』的数据 ? ; L7 A9 X; O" F) j4 A
/ S# T8 m( T2 X$ o想确定一下) u% e9 d: b5 w1 K+ e3 W A
谢谢!
G/ `& j+ e1 p, A8 K; v2 ~7 _ |
|