|
|
新手发问超简单问题,目前还处于研读范例码的阶段,边测边看结果来理解程序
V& r# m; Q \5 c2 Y& @4 ~3 o其中有一段如下
& ]1 R, `9 j% i" p) Eask turtles with [ infected? = true ]
3 i: L" Y$ O& @. W4 w我原本以为这句会回传『所有』infected? = true 的 turtle
& j, x* X0 k, }& |. K! u但看结果似乎不是这样。
k4 q3 H/ u6 @2 ~2 Y: s% u" Y4 h) q2 i$ n: J
假设所有符合条件的有 5 笔/ l3 a8 e$ e2 _
有时候回传 1 笔,有时回传 3 笔,是不固定的
6 M. Z F# ?& [2 R回头查语法定义6 Q, `# o/ d$ G: ?/ I# K1 |0 w& A
with
* ?3 }5 z# u) c9 P. \$ J! sagentset with [reporter]" Y( K( V" U% b; v! [! k
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 w7 \/ |3 {9 i0 J! Z- Y8 S它只说回传 agents satisfying the given condition
! R% N& \+ v# A) V是否 with 回传的是『符合条件』的数据,而不是『所有符合条件』的数据 ?
" w" @% u+ f5 ^6 a3 {
! Z4 v% `% }4 t+ B+ g6 a想确定一下
0 ?- v! O' ^& Y; V, X1 M/ q! Y$ L谢谢!* B) M$ n' b0 f
|
|