|
|
新手发问超简单问题,目前还处于研读范例码的阶段,边测边看结果来理解程序
! S# X! V! d4 R+ \/ d其中有一段如下
0 y5 A1 P/ D0 ?/ Gask turtles with [ infected? = true ] ) ~; Y% l# t' m! C5 ~. b) K+ P9 ~1 v
我原本以为这句会回传『所有』infected? = true 的 turtle9 }2 i1 w8 J* Q! i$ U
但看结果似乎不是这样。) W* N. G% d% I
/ c o# s x& m' H% a) b: h假设所有符合条件的有 5 笔
4 ?0 P* y2 {+ u有时候回传 1 笔,有时回传 3 笔,是不固定的+ }$ d* ^, z. t$ C- Y7 }7 y
回头查语法定义
8 w7 k, R' a2 U( i0 T* Iwith
/ \( \. _% K5 F" M* F" F+ \agentset with [reporter]2 _6 J" G2 R% Y0 r9 C. E
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.
6 c: Y& u, K$ ?& h' G! C3 R它只说回传 agents satisfying the given condition
9 z4 L( Z( I N, U @) B q是否 with 回传的是『符合条件』的数据,而不是『所有符合条件』的数据 ?
) @& U& R* m. N- m5 b8 A: e% o' F& M, r
想确定一下
6 ^+ j" j: Z8 [/ J谢谢!$ s! J6 N- e: @4 {
|
|