|
|
新手发问超简单问题,目前还处于研读范例码的阶段,边测边看结果来理解程序
# A. P/ y& `% ?, Y+ k其中有一段如下
: _1 B# v/ f zask turtles with [ infected? = true ]
+ H) u" W$ ?, d我原本以为这句会回传『所有』infected? = true 的 turtle
2 A- c7 ?( X W4 U: q N但看结果似乎不是这样。4 p8 U& w; ]& E, W0 E
~2 I' T$ w; l+ i$ @! I8 W
假设所有符合条件的有 5 笔$ F0 A- I, x* N* n5 h
有时候回传 1 笔,有时回传 3 笔,是不固定的
& F" U# i* |7 D4 }3 `回头查语法定义
6 ~% I7 E" M% W2 uwith
4 @3 Q. ]. X1 s& }! pagentset with [reporter]
$ ~6 G, l9 [- E0 D+ u/ f8 JTakes 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." Q" A6 S# I/ ^4 |
它只说回传 agents satisfying the given condition- N4 h; S8 @; B; M( _ N6 ` h
是否 with 回传的是『符合条件』的数据,而不是『所有符合条件』的数据 ?
3 Q* k) F- D9 b; x2 U$ ^ T2 h, W8 q \/ _7 i2 [
想确定一下
3 q2 R+ c4 X9 S谢谢!
9 e0 s R3 Q( g |
|