|
|
新手发问超简单问题,目前还处于研读范例码的阶段,边测边看结果来理解程序9 _- {; C3 b5 F6 B' C' v
其中有一段如下
2 n" w0 G3 v7 N S% r/ x. e' uask turtles with [ infected? = true ] - y. E5 t3 m# q2 R) ^. G. C7 D
我原本以为这句会回传『所有』infected? = true 的 turtle* t0 y* d- W8 E3 u4 k
但看结果似乎不是这样。
_, o6 f" \2 |. f4 Q* M) {8 O. P& I1 r* B, o, m, T$ {( d
假设所有符合条件的有 5 笔1 y. ^0 s% O6 p/ E* e
有时候回传 1 笔,有时回传 3 笔,是不固定的
7 I2 L% S) o3 ]2 U4 {9 B2 j: X回头查语法定义
4 g n1 J0 E* X& twith
2 c t' h" s2 D5 dagentset with [reporter]
1 T# Z% Z. K& `; k o3 W1 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.( q9 C9 P5 ]+ _0 Z
它只说回传 agents satisfying the given condition
3 ~* ^8 \3 j+ N9 J- B) l是否 with 回传的是『符合条件』的数据,而不是『所有符合条件』的数据 ? 3 i! }) W" r* [6 S& R' h
. N' x3 J8 t% _- m5 r! U' I
想确定一下- c3 _" a# j$ S- G+ X+ E8 Z
谢谢!
- G: u. b0 W$ b. _# { |
|