|
|
新手发问超简单问题,目前还处于研读范例码的阶段,边测边看结果来理解程序
- g) X3 n; [- D7 a; F- y其中有一段如下
. M& I, s6 }' j% |! u* r9 ?& Iask turtles with [ infected? = true ]
: Q3 P; e* O* f1 t y: ^5 G2 V我原本以为这句会回传『所有』infected? = true 的 turtle
1 C7 Y1 w, Z% k& F但看结果似乎不是这样。4 U2 n4 B5 }7 Y2 C$ a
. K5 W; S* e* z$ v5 E假设所有符合条件的有 5 笔. N! C, E: O! r# F0 q
有时候回传 1 笔,有时回传 3 笔,是不固定的
9 `& s a* P7 z% p回头查语法定义
* Z: d% \, D D& {- ~% Xwith
% y* I' g+ K% n6 m( e! K- Q5 E, Magentset with [reporter]: w0 W7 b7 r3 \. k0 {' p& [
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.
/ F0 J# T2 F" A, W) j- X5 L它只说回传 agents satisfying the given condition
- X7 }6 a2 |6 A* z1 u是否 with 回传的是『符合条件』的数据,而不是『所有符合条件』的数据 ?
- n: T2 p$ Q( Z) I8 r2 R! S0 \6 H
9 N: i/ o3 j5 h5 D8 B5 S" y想确定一下
, b+ P+ H9 v6 | g& [谢谢!
3 F2 F0 j/ X; J8 O3 S4 z |
|