|
|
新手发问超简单问题,目前还处于研读范例码的阶段,边测边看结果来理解程序* W) J- O3 b; a% O5 @ u" y0 h
其中有一段如下
* v; G: s& @$ w4 W1 k8 Xask turtles with [ infected? = true ] " {8 E) h6 B" D- n2 K4 G# c; y
我原本以为这句会回传『所有』infected? = true 的 turtle4 b3 g4 j" S3 Y2 D* A9 o4 l+ o
但看结果似乎不是这样。
( X: \' X+ m d1 ]% F3 b; R/ a7 y7 Q. y$ T8 \& X4 u: i& y
假设所有符合条件的有 5 笔
8 U2 n* L6 W4 x) A/ o# |! }; n有时候回传 1 笔,有时回传 3 笔,是不固定的) ?; G0 S4 p7 f) Q& k
回头查语法定义
. u5 k% T' @' ?% u% Owith : c! v" n0 O6 V. L; J% s$ J9 w
agentset with [reporter]& |$ j% L; w, s/ [
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.5 y2 V6 {, v" w9 n+ p$ g
它只说回传 agents satisfying the given condition, z% m& x* H& o2 ~3 f. u* `
是否 with 回传的是『符合条件』的数据,而不是『所有符合条件』的数据 ?
" G8 t+ w0 K j6 u8 V! Y7 H; o/ `/ z: S S2 i% w6 P
想确定一下- V" W7 X+ G+ U: @) B0 u6 C
谢谢!
& e o# N! H5 U5 q5 Y& j& V; I |
|