|
|
新手发问超简单问题,目前还处于研读范例码的阶段,边测边看结果来理解程序
! [; n5 X+ o. Y' v2 j7 @其中有一段如下
5 s9 K3 l- q0 U8 c1 L' K5 h1 r0 oask turtles with [ infected? = true ]
7 e. a7 C- R" D }" c% z我原本以为这句会回传『所有』infected? = true 的 turtle
: w# w* \* `1 E! a但看结果似乎不是这样。% X1 F `, b9 e& W. P; G
" C( @8 ` u, O5 a7 w
假设所有符合条件的有 5 笔1 B& _; `: y( B$ `, D/ B4 G) J
有时候回传 1 笔,有时回传 3 笔,是不固定的
' G, |7 F1 j, z2 o+ N" c- W( x回头查语法定义
' S: U4 x' P% _: ^8 V) Mwith
# X/ Z- U" P8 Oagentset with [reporter]
5 L9 u r& t# A/ ]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 k5 a! ]4 \) M; b' G
它只说回传 agents satisfying the given condition: z2 z& B1 g; W0 c1 V( d
是否 with 回传的是『符合条件』的数据,而不是『所有符合条件』的数据 ?
1 l8 D8 T! f2 B& X$ c" n
1 U [: @$ `5 Y5 y' v' ?想确定一下) M2 E0 B* f5 B/ }7 k* n; k
谢谢!0 x6 k$ F$ H4 C6 |& `. H
|
|