|
|
新手发问超简单问题,目前还处于研读范例码的阶段,边测边看结果来理解程序6 l1 `- n' z8 m' y, k; Y
其中有一段如下
; a- X2 h, x9 Z0 T: Qask turtles with [ infected? = true ] # l/ j& C# v" l' }
我原本以为这句会回传『所有』infected? = true 的 turtle% K+ W5 C# S8 x( T8 x. p
但看结果似乎不是这样。9 F- u7 |" Z+ N
( n# {+ Q! d X! R假设所有符合条件的有 5 笔6 |+ w3 j1 _) r
有时候回传 1 笔,有时回传 3 笔,是不固定的- K" h, W$ }: F) o) P! z2 g
回头查语法定义3 F) D+ D* ~8 i ]5 E# F
with
7 } r6 O& |- r; E* g$ H+ x. Kagentset with [reporter]
' t$ k0 {+ A# o9 ]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.' `: m) y8 o2 [, W+ }- c7 s
它只说回传 agents satisfying the given condition d# T6 z8 q9 b E j3 H" j/ e
是否 with 回传的是『符合条件』的数据,而不是『所有符合条件』的数据 ?
6 ?$ ?! {, t9 N9 X% J3 H' W, G/ ]5 c) H+ }
想确定一下
' ^5 L, V8 V' W6 K$ P谢谢!4 {$ p! ^# ~7 Y- p. T' _
|
|