|
|
新手发问超简单问题,目前还处于研读范例码的阶段,边测边看结果来理解程序( `4 @1 ?: h! T8 _( F) y, K! x
其中有一段如下
C5 @, b- b1 d( R: o+ ]7 Hask turtles with [ infected? = true ] : z" D+ d) P2 ~& p- d0 [. G( X
我原本以为这句会回传『所有』infected? = true 的 turtle
9 w, R ?' `+ P7 S e6 u6 T8 P3 t但看结果似乎不是这样。
5 D! c/ O! X& _) x6 o! E, x) \0 X. w/ D8 k2 }. e$ R/ l
假设所有符合条件的有 5 笔/ C, [, p2 F1 g0 m
有时候回传 1 笔,有时回传 3 笔,是不固定的
4 O- Y0 T: x! @6 R+ ]3 k2 `' z P2 @回头查语法定义" ~/ g) m/ ~0 d6 Y G
with
* Z6 V5 d4 J7 ]0 v7 l7 Nagentset with [reporter]- D$ u% v. p/ v
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.
- k. h4 _# y6 f9 j1 p* y, l它只说回传 agents satisfying the given condition2 K9 |4 b6 G) O* D
是否 with 回传的是『符合条件』的数据,而不是『所有符合条件』的数据 ?
. T1 m& ?( X- k5 }/ G- {
# z- p2 A. j& H想确定一下
# W/ L6 E9 O- Q% f0 L3 W谢谢!. N5 [. q! S K; Q! w
|
|