|
|
新手发问超简单问题,目前还处于研读范例码的阶段,边测边看结果来理解程序
5 {" c" K9 Y9 m' V5 p* U/ k! `) \其中有一段如下
) E$ |3 t& z/ P+ Rask turtles with [ infected? = true ]
5 T r# q) M+ q1 M+ S6 u4 a) ~我原本以为这句会回传『所有』infected? = true 的 turtle# N& Z2 r {: J% N/ m' Q1 a+ c- h! i
但看结果似乎不是这样。5 r1 g7 }6 W! O. H
- z: d d- o0 B- D& N% O假设所有符合条件的有 5 笔; G4 t7 Q, L% M+ Z4 U5 H
有时候回传 1 笔,有时回传 3 笔,是不固定的& W) n" @- e/ R; L
回头查语法定义
' R Z4 D1 k' R( @8 `2 bwith
1 S( M. J7 ?# Qagentset with [reporter]2 f% `, ~3 l5 S
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.
+ X( b/ V. g. F% t, b6 O它只说回传 agents satisfying the given condition
% o# o6 z. Z) x是否 with 回传的是『符合条件』的数据,而不是『所有符合条件』的数据 ?
, @2 x% ]/ S; E" l# y6 Z2 A, M3 Y) X( b& E, P# X& e1 q
想确定一下
5 X8 M0 {% l$ w谢谢!
3 j" x$ f3 U. ] |
|