|
|
新手发问超简单问题,目前还处于研读范例码的阶段,边测边看结果来理解程序 R* p' \2 s% M" K( J
其中有一段如下
* R, `6 A& d6 M* bask turtles with [ infected? = true ]
6 w$ k6 o7 O) @5 r) [7 O$ Z5 u我原本以为这句会回传『所有』infected? = true 的 turtle
~7 Z$ t1 a7 r. M# r% F但看结果似乎不是这样。
. ?$ s: e# f; A% `% x( A- a. {3 k
) a! ~1 _( b' C! z假设所有符合条件的有 5 笔9 O- i& ~" [( Y( g' O8 W' d
有时候回传 1 笔,有时回传 3 笔,是不固定的4 t) v- }6 N) ]" p
回头查语法定义) [ g# p/ k9 b7 G- E! g2 o
with
6 m( B, I8 f2 }* \1 ?' d# aagentset with [reporter]) r+ S4 O' p2 T4 P9 R2 T! z+ T3 `
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 R. @, T# Z; V: g2 N它只说回传 agents satisfying the given condition( C# g& z+ ^3 H! i! a
是否 with 回传的是『符合条件』的数据,而不是『所有符合条件』的数据 ? ' E& U+ j/ O" B5 k
0 Y/ X+ U% N4 |6 a
想确定一下
7 g+ T2 e$ n, l$ K* K: v0 w9 q* p谢谢!$ @. ?2 }7 z. t y4 _
|
|