|
|
新手发问超简单问题,目前还处于研读范例码的阶段,边测边看结果来理解程序8 t* l5 J$ q! p# H/ `; I% r) B
其中有一段如下
. K3 @; }9 X, Bask turtles with [ infected? = true ] " A% |. ~; Y# F7 X6 Z3 Q/ m# C1 i( d( m
我原本以为这句会回传『所有』infected? = true 的 turtle
% F* _' r$ L2 R3 N但看结果似乎不是这样。
4 G: O3 z( t, {0 _3 n9 Y1 I. ^8 u; Q& R/ o5 m: T0 `9 c: Q; G
假设所有符合条件的有 5 笔
m$ L) N+ j' p3 Z4 E* K有时候回传 1 笔,有时回传 3 笔,是不固定的
( {* H0 G4 g' M, ?6 d; T( E7 M回头查语法定义$ r/ c: y* I/ T( C
with 1 g0 ?* V' l! d T
agentset with [reporter]7 m1 h* b7 P% H! Y0 a( g; t
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./ T! f6 h# r0 \$ Y% p5 n
它只说回传 agents satisfying the given condition* h3 ?. O% J& w( @8 I
是否 with 回传的是『符合条件』的数据,而不是『所有符合条件』的数据 ?
/ _6 ^ c7 S. p- ?: k0 R2 [* Q6 c& p" J4 T" x* u7 Z
想确定一下0 Q# T6 L; P5 L6 b
谢谢!
y, }9 a, g4 N* A |
|