|
|
新手发问超简单问题,目前还处于研读范例码的阶段,边测边看结果来理解程序
- J: ^& t6 y; T0 y% b5 I其中有一段如下
2 b- S* f: Z3 Eask turtles with [ infected? = true ]
$ O; c' ?! P* f3 S3 ~4 L5 T: h: `我原本以为这句会回传『所有』infected? = true 的 turtle: G! k" V2 i: P4 x$ Q+ [8 R. p3 A8 A
但看结果似乎不是这样。- U" A( x3 V/ }6 N( R
; q) O/ q' I1 v' k% D假设所有符合条件的有 5 笔
4 A @8 B, _6 b/ Y' R0 @- m有时候回传 1 笔,有时回传 3 笔,是不固定的
4 e/ c7 `, ], {7 b回头查语法定义
& G0 V* ~( V% w& qwith t/ p( `9 v; q; R( u' d9 C
agentset with [reporter]
7 U8 U3 @5 v% s2 x A- ]' R7 c, ZTakes 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.
% v0 k/ `3 B' M/ e: c3 M& l它只说回传 agents satisfying the given condition
% ^1 t9 c, s- s" B1 }是否 with 回传的是『符合条件』的数据,而不是『所有符合条件』的数据 ?
+ P1 K9 x2 k" `1 @' [0 Z9 C% R' R! D
- E7 d$ f* Q' ^! V2 }4 O/ F5 }想确定一下
- |6 I) N8 M. m谢谢!) V" b/ w' w+ X9 O5 D4 h; G" x
|
|