|
|
新手发问超简单问题,目前还处于研读范例码的阶段,边测边看结果来理解程序
2 N) I: Y0 d3 E% m4 Z; |: J: a) q( G" K其中有一段如下
( O' l# P% U$ y& ^; F; C$ z% oask turtles with [ infected? = true ]
0 j7 l$ F: _: w我原本以为这句会回传『所有』infected? = true 的 turtle
% g' ?: [5 `0 n! X- ?: [但看结果似乎不是这样。
0 x& d' Z4 x/ D7 P0 S1 u
( q+ |( ^3 J! x8 T8 S: V假设所有符合条件的有 5 笔
6 A2 f) R# e8 i5 b4 _1 X/ w有时候回传 1 笔,有时回传 3 笔,是不固定的
9 {$ T" H& O: i2 ]回头查语法定义
4 v: k1 }$ ^5 u) [! e8 Ywith
# D1 W H3 R! ?; D8 b" D! nagentset with [reporter]7 S9 l k# B, j6 C/ 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.
1 Q5 P+ z7 h" v3 I: U4 R它只说回传 agents satisfying the given condition
1 J8 u6 V1 g+ F/ T: Z是否 with 回传的是『符合条件』的数据,而不是『所有符合条件』的数据 ?
" t$ B1 P7 b8 p
' F' u' I0 b2 z5 `# f想确定一下
, |- E' `* k: R# }谢谢!3 o+ i5 \" P4 P8 q+ u
|
|