|
|
新手发问超简单问题,目前还处于研读范例码的阶段,边测边看结果来理解程序
$ @9 q( I x& |其中有一段如下
. V" x9 e4 O) J; vask turtles with [ infected? = true ]
2 V( a- ~. a6 [2 Z我原本以为这句会回传『所有』infected? = true 的 turtle
7 U& m, P& K0 X- G) u q3 q7 }但看结果似乎不是这样。
# @$ P. R1 u5 |2 v- p$ K9 W! r8 N4 Q- W, |/ @$ d
假设所有符合条件的有 5 笔
/ k3 N3 }/ R6 y3 f% K" v) a有时候回传 1 笔,有时回传 3 笔,是不固定的+ s( L, t# k+ ~! s
回头查语法定义8 {0 }* {" C6 i0 A, C% Z
with . D6 H& b) v; R
agentset with [reporter]
6 D8 R' q* _9 q9 N6 YTakes 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 u$ i. A2 W9 t+ E0 t, x它只说回传 agents satisfying the given condition
8 V, a/ f+ n5 N9 C1 t1 g9 ]9 v是否 with 回传的是『符合条件』的数据,而不是『所有符合条件』的数据 ? 8 X! p6 A" C; P+ e0 s& Q
" a. p& N" a$ Z8 I想确定一下
) _% f) T7 v% Q& |4 f谢谢!1 z5 d" K; b+ ~5 m4 T8 e
|
|