|
|
新手发问超简单问题,目前还处于研读范例码的阶段,边测边看结果来理解程序! b' x% ?) j" L/ E4 }
其中有一段如下
- A8 [- B! v( ~& Sask turtles with [ infected? = true ] 5 U) p) q0 Q* Q6 D- w8 q% c+ `
我原本以为这句会回传『所有』infected? = true 的 turtle+ B2 I3 t4 D, A( {0 p0 i0 r" @
但看结果似乎不是这样。
9 V2 A! ^& o2 j- Z/ m+ \' l2 W1 A H0 E0 P1 L4 g
假设所有符合条件的有 5 笔
; s% s$ _3 y4 {# a+ |: y有时候回传 1 笔,有时回传 3 笔,是不固定的# Y' n9 s2 B2 D
回头查语法定义
1 u( L5 x# Z+ F# r2 F* ~8 h% |7 c3 xwith
# Y W3 q$ A% k+ _: B9 Bagentset with [reporter]
# E! W; x5 s! x- BTakes 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' C4 X, K4 r它只说回传 agents satisfying the given condition
) V+ _8 Y8 ?8 c; H+ c; o# e/ q是否 with 回传的是『符合条件』的数据,而不是『所有符合条件』的数据 ?
% c: ]% `6 v y: ?0 F/ v/ m7 a0 T7 \) E$ | C8 o
想确定一下
9 I% z# M ^" C* C谢谢!
0 P, d2 N4 F& r0 C: Q% Q' F |
|