|
新手发问超简单问题,目前还处于研读范例码的阶段,边测边看结果来理解程序* A: p2 a: o7 h2 L/ ?
其中有一段如下
% s2 v# z9 j; Yask turtles with [ infected? = true ]
, o' |8 O: ~, P8 W+ w5 b) I我原本以为这句会回传『所有』infected? = true 的 turtle- _) x! `: B: B+ ~& m
但看结果似乎不是这样。( {+ P/ ?9 S$ H8 m
/ S1 S' Z: P2 k7 K& w* Z
假设所有符合条件的有 5 笔0 T K8 j* i& d% r- a+ \
有时候回传 1 笔,有时回传 3 笔,是不固定的
6 x& N" u, m- d1 Q6 @回头查语法定义
* w% ~! L- M7 e1 vwith : X5 F5 g- L+ V# A0 `
agentset with [reporter]0 J4 _3 e( h; \/ F
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.# b8 A1 b. k$ B) Z" i$ i4 ~! r" P+ z( J
它只说回传 agents satisfying the given condition
; U5 @6 K+ g4 K7 x是否 with 回传的是『符合条件』的数据,而不是『所有符合条件』的数据 ? * [$ @2 b( O1 l. K" x
6 }6 `: {2 {5 [. m0 A1 D7 D' |
想确定一下
& E R1 w4 i9 o* i/ R% ?谢谢!' u. N% i4 Q% l% e' G
|
|