|
|
新手发问超简单问题,目前还处于研读范例码的阶段,边测边看结果来理解程序
$ [; }2 T9 D) Z$ Z6 ?其中有一段如下
# y3 p% z$ T, \1 w- Qask turtles with [ infected? = true ]
" {0 j+ P8 m8 k& g. p3 D3 R4 K我原本以为这句会回传『所有』infected? = true 的 turtle4 ~6 \ @- J7 W
但看结果似乎不是这样。& T: {5 J, e" I- `/ a' t4 s* [
* ]1 L0 h+ n/ C5 S8 u! V假设所有符合条件的有 5 笔% Q& o$ F9 D I
有时候回传 1 笔,有时回传 3 笔,是不固定的3 R6 S7 K3 k5 O+ a" a
回头查语法定义' D4 Z* n- n1 |+ ]! H
with
2 f3 N- P4 k2 j# Bagentset with [reporter]& R O' D) t! d$ i( J. s3 @& 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.- [" ]: \4 ^- h. X0 s. g- R
它只说回传 agents satisfying the given condition8 O( q ^* ^( H
是否 with 回传的是『符合条件』的数据,而不是『所有符合条件』的数据 ? $ U" r: f' m9 E: Q) }
: e: W9 I: N& N' u' p0 S
想确定一下
# k) I; S a; y谢谢!
* q, J5 p9 q8 s' |3 L |
|