|
|
新手发问超简单问题,目前还处于研读范例码的阶段,边测边看结果来理解程序
2 S K9 ]* x. v$ F, ?) p. T其中有一段如下, X& I3 N# F& k! }# y( r
ask turtles with [ infected? = true ]
' j; ~1 I1 }4 u+ d6 N* u; V我原本以为这句会回传『所有』infected? = true 的 turtle
7 W9 a0 r& _! q. g# M7 I& a) p但看结果似乎不是这样。- D) m# U, p5 M/ E+ \8 Y; K
# D$ I% Y, x* P# _
假设所有符合条件的有 5 笔, {- k8 }9 b+ y0 s e/ C
有时候回传 1 笔,有时回传 3 笔,是不固定的
: D6 L4 o9 n/ ^! a7 U+ P回头查语法定义$ L/ \; m- c) t$ }& H0 Y
with ( [) g4 h6 z, [! H6 s/ |6 K
agentset with [reporter]8 w* g8 @" [% ~+ G
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 h) u$ `" X) ?- L" g$ R( K
它只说回传 agents satisfying the given condition
* T' Y8 v) o* g/ |是否 with 回传的是『符合条件』的数据,而不是『所有符合条件』的数据 ? * o$ z& Q& Q$ V- M1 t
8 O x6 ?# J" y8 U, ~: w/ B
想确定一下; j/ ^5 x1 _, ] Q. q
谢谢!/ g0 V: J; l" A# D
|
|