|
|
新手发问超简单问题,目前还处于研读范例码的阶段,边测边看结果来理解程序/ H1 M( A a1 Q" g
其中有一段如下
- \' ?& C2 D, V+ v h; b. oask turtles with [ infected? = true ]
) S6 r N" H' ?( s M& ^( A* p; p+ Z我原本以为这句会回传『所有』infected? = true 的 turtle
( @9 E0 B: ^6 L但看结果似乎不是这样。
+ p& L& h3 }* j- @" L0 }9 V0 V+ T- Q/ [: ~6 `4 ^% f
假设所有符合条件的有 5 笔% f% Z7 }, F* e
有时候回传 1 笔,有时回传 3 笔,是不固定的
% D8 k& J9 Y0 \8 f) _- D2 J回头查语法定义& {7 j* o6 X! `& X1 ?6 v
with + S- m2 h/ i9 D% S0 C; Q, R' c
agentset with [reporter]
0 \" K# c1 {4 p9 T, W4 lTakes 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.
/ Y" K6 b7 c2 q( q2 A, T它只说回传 agents satisfying the given condition
N* n: m$ u8 l8 E# A% q是否 with 回传的是『符合条件』的数据,而不是『所有符合条件』的数据 ?
5 s# F5 r3 F7 X7 l1 @2 g V. n3 i: `" m
想确定一下( q4 k9 `, F0 G4 V/ H% ]% f
谢谢!
. W0 }, H1 `/ _- q! c0 [ |
|