|
新手发问超简单问题,目前还处于研读范例码的阶段,边测边看结果来理解程序( P2 V5 ` o! E( r3 ]9 A$ C
其中有一段如下
) x8 n9 t# `0 B5 y# n* task turtles with [ infected? = true ] # F5 I; \% P6 u, S/ H' Z$ b9 k, n
我原本以为这句会回传『所有』infected? = true 的 turtle7 B, S h! Y2 Z- S
但看结果似乎不是这样。
* |% \5 E4 J7 R4 \3 f5 j, b- k, ^! ^" w4 W7 B. t
假设所有符合条件的有 5 笔
7 a* w( ?# {3 j有时候回传 1 笔,有时回传 3 笔,是不固定的
5 r$ R d& G6 O$ c2 }) W回头查语法定义4 b# y2 h- d4 w5 ?
with 3 _) Q/ `; Z' S1 j, S
agentset with [reporter]6 {; k0 u. K7 d) j/ L3 ]
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." R7 ]: \) f9 {) J" q
它只说回传 agents satisfying the given condition, D& n o/ j+ M8 l
是否 with 回传的是『符合条件』的数据,而不是『所有符合条件』的数据 ?
! {7 ]5 a$ B# P: L& Z" A( W. z. @( L# e: Z b
想确定一下
0 A" w$ V! T3 w8 t* n谢谢!% a3 N$ S4 T) z( E1 A& I S. g8 Q9 K
|
|