|
|
新手发问超简单问题,目前还处于研读范例码的阶段,边测边看结果来理解程序
' u" D, x& c7 u3 {其中有一段如下
$ _6 T/ Z7 l+ l. j/ c" `* sask turtles with [ infected? = true ]
* V9 G9 G' T' J6 g: c% T: ^我原本以为这句会回传『所有』infected? = true 的 turtle/ k4 ~1 o4 `. ]) H: j: C
但看结果似乎不是这样。# e7 r. k3 e6 J/ o+ S
: L9 d, d; t6 V% t& ?/ s' E假设所有符合条件的有 5 笔6 y- X( X x$ C; p) P7 [
有时候回传 1 笔,有时回传 3 笔,是不固定的
! Z; A9 r0 a6 ?) c8 m& ?1 v" Y回头查语法定义7 ]% O9 M) V4 P% `
with 0 K6 h, o3 f% v; V1 Z
agentset with [reporter]) r+ G' C5 C2 V4 Q0 J1 U) ~2 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.* D- {0 L: C5 Q2 k
它只说回传 agents satisfying the given condition
1 p% m- t( ] }, R4 e是否 with 回传的是『符合条件』的数据,而不是『所有符合条件』的数据 ?
: e: M+ w3 q- E( X) a/ ]% E
' y- g9 Q$ i u想确定一下5 T9 b U; L$ q; I- W
谢谢!' A4 `( c8 F Z* O& R4 M+ Y
|
|