|
|
新手发问超简单问题,目前还处于研读范例码的阶段,边测边看结果来理解程序" t4 x7 o- T0 y# m9 r4 Y* E2 V! Z" _- n- V
其中有一段如下
, W; d! c) c) l& @- |$ p" eask turtles with [ infected? = true ] , m! z2 J i# \2 Z$ {0 {
我原本以为这句会回传『所有』infected? = true 的 turtle0 u5 ?1 P+ w2 { ~- \' a! S
但看结果似乎不是这样。
: D: o9 K& D9 V- Q& I/ F
2 `# t0 A! h9 M- x# @% ~& |假设所有符合条件的有 5 笔
2 t0 b" E# X/ D+ @' Q1 ?' L, R有时候回传 1 笔,有时回传 3 笔,是不固定的
; T. o$ S- k0 y$ O) A2 e; M回头查语法定义7 h2 B. z/ U3 {2 e
with
8 X% l4 a2 v1 L* B8 {; iagentset with [reporter]& e3 p9 J2 d- z! q* G5 r
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.
" p, K* f& C( [. Z9 F# j; @9 N/ u它只说回传 agents satisfying the given condition( N- l$ g# j. S: [3 s
是否 with 回传的是『符合条件』的数据,而不是『所有符合条件』的数据 ?
; k2 I9 c; Z. F9 Q6 S6 x# Q
8 @' i! M- h9 A想确定一下
- j. X6 J8 |! w$ t5 g: t$ Z谢谢!- ^# }1 F$ N, m2 j1 D3 \
|
|