|
|
新手发问超简单问题,目前还处于研读范例码的阶段,边测边看结果来理解程序% ?/ ^/ L" Z+ S7 P
其中有一段如下
3 O# a$ x5 V( a* c; i0 Dask turtles with [ infected? = true ] ( H% c! e* c. s
我原本以为这句会回传『所有』infected? = true 的 turtle
1 g' D2 n& U% k" X* q' W但看结果似乎不是这样。
- c! ~3 l9 H' c0 `; ~+ b: x9 J$ ?! w
假设所有符合条件的有 5 笔4 q6 U6 O/ ?" Y, C& O4 ~; v- }7 w- t
有时候回传 1 笔,有时回传 3 笔,是不固定的
. Y" c- b2 F1 B( l回头查语法定义8 X0 ~- i! |$ C1 |
with
4 `. J' L, `& v( a! ]* nagentset with [reporter]7 x& o. i" m% f. i4 L
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.( n- i1 k# X4 V
它只说回传 agents satisfying the given condition u4 _' o8 u D& m9 G, s, v( [
是否 with 回传的是『符合条件』的数据,而不是『所有符合条件』的数据 ?
% ?. D6 W/ G/ a% d: ~2 z, B% Z! |5 z7 T
想确定一下
5 w8 F I, M# f' S6 _) j谢谢!
" f, [- V5 ]( C( ], l |
|