|
|
新手发问超简单问题,目前还处于研读范例码的阶段,边测边看结果来理解程序
7 X- c7 h: C9 k0 \0 g& \6 x) B其中有一段如下
2 T, I6 H* V( [ Y; uask turtles with [ infected? = true ] ( K+ t' L! @ R, ]
我原本以为这句会回传『所有』infected? = true 的 turtle
( y6 I+ H, i+ o; T# t2 Q但看结果似乎不是这样。
1 T0 e, w4 F C% C7 A* z4 W; T0 A0 Y c2 A4 o; p
假设所有符合条件的有 5 笔
. |2 S4 n1 }9 {有时候回传 1 笔,有时回传 3 笔,是不固定的
# N* ]) Q: \+ |+ p回头查语法定义! @, m, I' ]4 E1 B/ D
with
# ^* |4 Y8 H* D* F& aagentset with [reporter]
; b3 \4 u8 Z! Y5 }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.# O3 P7 x' p) o0 J! h2 O/ p
它只说回传 agents satisfying the given condition
- O* q }- @- F: G是否 with 回传的是『符合条件』的数据,而不是『所有符合条件』的数据 ? * ]0 ]! p, n# T$ b8 ^2 K. b; @
$ H7 {3 J1 ^, v5 F4 N1 h; u
想确定一下
9 q) _0 h) P; `谢谢!# S T1 j+ j0 r. ?6 r" D- |
|
|