|
|
新手发问超简单问题,目前还处于研读范例码的阶段,边测边看结果来理解程序: |2 x# L- g8 l8 s# B
其中有一段如下
& }8 g# T' }- }" C/ Eask turtles with [ infected? = true ]
; v5 _& W# m7 O0 Q6 e3 U+ f我原本以为这句会回传『所有』infected? = true 的 turtle
8 v3 o7 ^! s3 i5 d3 v: z但看结果似乎不是这样。
3 q; l- j$ T" a4 q2 E* H. @* [: ]4 G4 _1 X, k8 L; Q
假设所有符合条件的有 5 笔# D3 U, I) ^* B/ Y1 x% {) V3 f' C
有时候回传 1 笔,有时回传 3 笔,是不固定的
6 y1 c8 |( D+ B% T8 X' b) I6 e回头查语法定义" d% X; U8 _) u0 S
with `) L+ e7 `) f" t2 B7 D8 k& e
agentset with [reporter]
! V+ ~ O( }7 k, hTakes 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.7 R2 K& i9 K1 e8 ]0 b! v
它只说回传 agents satisfying the given condition2 V) x+ b' ?$ }! k3 v
是否 with 回传的是『符合条件』的数据,而不是『所有符合条件』的数据 ?
H; n; G4 z' o) y* {. ^/ ?" T3 j1 M! o+ M9 _
想确定一下2 }' M8 `) u+ Y: K6 m4 V
谢谢!( B7 F( q4 n7 ]" z% v# E) x9 i8 [
|
|