|
|
新手发问超简单问题,目前还处于研读范例码的阶段,边测边看结果来理解程序
" a' m& a8 g* r其中有一段如下
; ^: ~2 \+ T/ ^2 P0 W' z7 Qask turtles with [ infected? = true ]
/ X W( f9 [9 ^9 C$ _5 c% m我原本以为这句会回传『所有』infected? = true 的 turtle
* ~- Q- Z6 d. A# q$ T. T$ P但看结果似乎不是这样。
# T& h5 ~0 g: _% r, w
+ i& s7 o/ }6 w5 h; g假设所有符合条件的有 5 笔2 ` Q d ]: G" B! M
有时候回传 1 笔,有时回传 3 笔,是不固定的
8 X& O ^4 O7 G) D6 ?回头查语法定义0 | c& f& t# x5 B+ p" V C
with 4 d/ [! a9 c2 }! P
agentset with [reporter]8 K @+ ^9 }1 v( 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.
4 Y* J, P' S/ \$ }( d它只说回传 agents satisfying the given condition' H% m2 X; x+ w3 K1 B
是否 with 回传的是『符合条件』的数据,而不是『所有符合条件』的数据 ? ; E$ y- |; W& L! C0 R5 Y( O
/ f* d: v" j) I# M( f* {0 j% F8 P# c
想确定一下
7 Z! h$ g. y( L% E' w谢谢!0 ?5 Y H5 O# K# s
|
|