|
|
新手发问超简单问题,目前还处于研读范例码的阶段,边测边看结果来理解程序+ ^7 D' Z: @$ G& z4 o1 J' @
其中有一段如下
* i8 x; S& Q1 {9 b" ^) vask turtles with [ infected? = true ]
- C4 H( P" c! [6 V) }) ~# ^我原本以为这句会回传『所有』infected? = true 的 turtle
6 o3 J5 e% C5 [' i& k* H但看结果似乎不是这样。, a$ I% y2 I f9 m4 |7 C! z3 j5 j
) |: {$ C+ F$ h4 Y+ N
假设所有符合条件的有 5 笔3 H7 d# h( G% \ V3 I9 w% b4 b& K- y y
有时候回传 1 笔,有时回传 3 笔,是不固定的
4 H& X6 d! i9 Q9 ~; v回头查语法定义' C$ V1 N/ a$ K* e1 Q
with ; g1 @( P$ H6 {# y3 ~5 e: T- G
agentset with [reporter]
) {* O0 a7 R/ A3 @3 uTakes 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.
/ E+ U1 [- X& j5 G1 K( v它只说回传 agents satisfying the given condition
& Z% o- `: k+ M# X是否 with 回传的是『符合条件』的数据,而不是『所有符合条件』的数据 ?
$ L; e! u9 \; c \. E9 ^8 m p9 S. f
想确定一下
% {, X7 G) y, Z7 a# h谢谢!
, p1 e; _( O$ k- ?/ R |
|