|
|
新手发问超简单问题,目前还处于研读范例码的阶段,边测边看结果来理解程序4 k3 }0 N+ }6 o7 J
其中有一段如下
. K7 b3 F- F- O8 Q% |9 Kask turtles with [ infected? = true ] 1 N3 w$ y2 X4 R
我原本以为这句会回传『所有』infected? = true 的 turtle
6 ^0 _; O- R: V1 k5 |但看结果似乎不是这样。7 x$ M# O8 r; n( V7 P
8 q* R6 X, E p' Y1 _
假设所有符合条件的有 5 笔
6 H$ v+ n/ u" _/ r; |3 V4 y% @有时候回传 1 笔,有时回传 3 笔,是不固定的
& H8 b% f* T2 m" Y8 \" \- T- z% I2 ~回头查语法定义
& J! ] P, B. t4 @7 \# Iwith
* k: H9 J5 Y, r8 H3 Yagentset with [reporter]8 h9 {, s0 r* s1 W, ]
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.
, j- m! G2 W' N. b2 B" W它只说回传 agents satisfying the given condition
4 h; S7 l3 g, \4 a. k' k1 a" u是否 with 回传的是『符合条件』的数据,而不是『所有符合条件』的数据 ? 8 M$ b# D1 o( ~4 k
% Z1 b- H: q+ R% t2 x, A想确定一下
2 p- V6 p9 f& _谢谢!3 _/ p. G3 d+ p4 {
|
|