|
|
新手发问超简单问题,目前还处于研读范例码的阶段,边测边看结果来理解程序7 @$ A U$ O! W3 c
其中有一段如下
3 g- U, J3 q: O# ~ask turtles with [ infected? = true ]
9 Y- k* c/ N* x0 h9 U9 t+ o我原本以为这句会回传『所有』infected? = true 的 turtle
" ]5 z, t: R3 U/ E2 l但看结果似乎不是这样。1 E' v# C8 Y# T: f; X% ]. r
6 w- M) ~; Q+ k; I+ k0 j% E- E9 O- j1 E假设所有符合条件的有 5 笔
) j: \( m, j$ C* T+ p有时候回传 1 笔,有时回传 3 笔,是不固定的
4 u+ B$ C& X% E, \回头查语法定义3 V5 W0 Q8 Q: }- _/ g8 H& T
with
7 }- w- L1 s3 X1 Ragentset with [reporter]8 H. o7 p0 l+ X" }
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.8 h x/ [( V0 x- T1 u+ m
它只说回传 agents satisfying the given condition8 S) v6 u4 A' T# H: v
是否 with 回传的是『符合条件』的数据,而不是『所有符合条件』的数据 ?
/ f% x' g* Y; s; U+ B
4 U( @: A8 Y) X+ {想确定一下
0 X+ l4 a4 k0 `: u谢谢!5 z& i! Z$ r$ Y! h% V2 v+ k, Y
|
|