|
|
新手发问超简单问题,目前还处于研读范例码的阶段,边测边看结果来理解程序3 H7 k) O1 C# m) E2 Q
其中有一段如下
- M! I: Y1 l. d* f/ ?, \! c$ lask turtles with [ infected? = true ]
: Z) I0 v5 ]/ P/ \3 {) B我原本以为这句会回传『所有』infected? = true 的 turtle
/ V! @, o8 L% t3 c: y& l1 l但看结果似乎不是这样。; m9 ^( f( p1 B( C! D) W
$ q+ N( ]1 f/ f r6 L7 ]
假设所有符合条件的有 5 笔
1 u* _! f/ u2 {( v5 C9 F$ A \6 A有时候回传 1 笔,有时回传 3 笔,是不固定的
7 D& V5 b2 s; O3 c回头查语法定义2 g' N; H3 U; G5 [" ]
with
* z, j8 X' P8 j* {! w2 |) Jagentset with [reporter]) m1 V! P3 X: N& h
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.' b1 w8 T4 m8 _) G1 D2 P0 F; q
它只说回传 agents satisfying the given condition3 @+ s) X6 c0 G1 Y' A4 O
是否 with 回传的是『符合条件』的数据,而不是『所有符合条件』的数据 ? ' e$ Q. L% d8 q, A
& b5 h: s& w* _0 c$ N8 @4 }+ b
想确定一下" n0 f& x7 X$ ]3 C
谢谢!
$ A/ S1 t N) H; h& z0 k |
|