|
|
新手发问超简单问题,目前还处于研读范例码的阶段,边测边看结果来理解程序
" r C, F' W8 f9 I, }# M其中有一段如下
. Z8 ?9 }3 `9 ~% Z% b; Gask turtles with [ infected? = true ]
. O' b$ B3 G, S" P1 B! H) f我原本以为这句会回传『所有』infected? = true 的 turtle
1 `4 p! I+ C+ M, l' j但看结果似乎不是这样。8 B% W$ I8 W6 c
( q2 n! U7 Z! o
假设所有符合条件的有 5 笔
: L% C* t8 p- `! S. x) F, W有时候回传 1 笔,有时回传 3 笔,是不固定的6 F& L# }4 {; F
回头查语法定义# h& w% o% ^9 z$ z$ t/ F- e
with # J _$ |$ p9 C
agentset with [reporter]
& E5 N5 H. t8 _; Z0 a# X/ ~7 O; ?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.* K1 U' G8 \- M0 ]; I6 Z
它只说回传 agents satisfying the given condition
+ n' d* J# ~. o; [8 A* @* q是否 with 回传的是『符合条件』的数据,而不是『所有符合条件』的数据 ?
# `2 Z* X+ ^- X4 D" F" [4 G' u# O; i% h) L
想确定一下
( O% b- B7 K: A5 [谢谢!- s' e0 k# p2 D
|
|