|
|
新手发问超简单问题,目前还处于研读范例码的阶段,边测边看结果来理解程序
# U2 K5 w$ {! I+ ^' f: u其中有一段如下
" f" t1 X$ ^4 y6 N% l$ {& Nask turtles with [ infected? = true ]
1 ? Z7 J* U# R$ z0 o$ q D; Q我原本以为这句会回传『所有』infected? = true 的 turtle Z0 H7 z* Z/ U" c2 ^; a2 g
但看结果似乎不是这样。
6 ^( _( D: q, u6 k6 V
2 L& o: H! k( a4 F假设所有符合条件的有 5 笔: s* l. f' O2 Z. [
有时候回传 1 笔,有时回传 3 笔,是不固定的6 _1 A& A) I' V7 _. H P1 d
回头查语法定义
+ m3 B# q9 `' V; ~2 bwith . {5 {. Z( a: p$ S6 z" }* \; N' {
agentset with [reporter]' D4 W+ l. w6 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 w( }- _# k8 q+ m( }它只说回传 agents satisfying the given condition
/ D1 g7 D5 c% V是否 with 回传的是『符合条件』的数据,而不是『所有符合条件』的数据 ?
6 e8 ^" r8 n: t- R) F& a* ]1 _" R
想确定一下) Z7 [/ P2 O9 k z' @$ [- E
谢谢!
7 c& E8 u" p5 Q |
|