|
|
新手发问超简单问题,目前还处于研读范例码的阶段,边测边看结果来理解程序
+ K- X4 K: I7 p# D0 f" n1 ?1 M其中有一段如下
- n3 q' c, {1 R# Yask turtles with [ infected? = true ]
3 S8 X- v: L y我原本以为这句会回传『所有』infected? = true 的 turtle3 E0 [0 S! B. y
但看结果似乎不是这样。$ ?( v) b$ |% k0 Z
1 {% N0 a `1 n# J% K, C7 z假设所有符合条件的有 5 笔+ G! V+ d6 c( ?* O8 O0 B
有时候回传 1 笔,有时回传 3 笔,是不固定的
9 @2 u& s- K7 W回头查语法定义) ?& V/ p/ k/ r! a8 ^; i, r
with
" D% o& N* L9 ~agentset with [reporter]
5 D) T8 q; l* Q, e3 ~6 F+ MTakes 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.$ ]% @$ C+ U, _& F- G
它只说回传 agents satisfying the given condition1 E! P N$ y! D- Z( l
是否 with 回传的是『符合条件』的数据,而不是『所有符合条件』的数据 ? . ~, d3 a% V6 u/ \
4 n+ K$ ?3 I% S% j: s7 ~想确定一下5 j* Y+ u# y3 g. y
谢谢!
5 z- v! a3 {) u4 M( Q: ? |
|