|
|
新手发问超简单问题,目前还处于研读范例码的阶段,边测边看结果来理解程序
% m" ^& o8 U: T5 \4 r" h' l其中有一段如下
: ]- {; m" G* V. M% O6 Z; E' b: jask turtles with [ infected? = true ]
3 w, u6 L' v6 ~( G. B我原本以为这句会回传『所有』infected? = true 的 turtle
9 M! ?4 M. v% w2 |4 w; c( i但看结果似乎不是这样。
8 v6 q4 J2 D2 `6 B" y! I. a4 y
* P. }9 M8 P+ q/ e; Q" H w假设所有符合条件的有 5 笔9 t$ L* y) K) j1 q- O' b) Y
有时候回传 1 笔,有时回传 3 笔,是不固定的
7 U. q7 ~3 x. d$ e# P; R, V回头查语法定义/ G- H1 V" s1 b* J2 ]: O- n" c
with
3 k3 H0 k7 f) s: G1 Z0 {+ _8 e( ?2 e2 v' Bagentset with [reporter]& S8 _7 ]! H/ p- i9 T5 r! A. s; `/ K2 L
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.( B/ G' f2 S h6 b4 t
它只说回传 agents satisfying the given condition
# Z" k3 `( b% ^6 ~ L& ^3 f是否 with 回传的是『符合条件』的数据,而不是『所有符合条件』的数据 ?
$ } c3 ^* Z1 n: [3 \
9 p$ [; e: T5 I0 { l P想确定一下) q/ W; Q. h( y# k% T. d- E- X% G
谢谢!
1 t; o, @% k8 X+ O& s- r( Y |
|