|
|
新手发问超简单问题,目前还处于研读范例码的阶段,边测边看结果来理解程序% f8 P7 {1 m- ^) ]+ E1 e/ F
其中有一段如下
* n- X) A& M4 y J) M. Pask turtles with [ infected? = true ] 8 X! N0 [& |* i+ W! b% \
我原本以为这句会回传『所有』infected? = true 的 turtle- ^8 ^' _6 A8 e- n Z5 l
但看结果似乎不是这样。. _" l. U0 l: u/ h2 u- X% g
) t" M# d8 q0 L4 V/ y5 q
假设所有符合条件的有 5 笔
; N, U# U' G0 Q: N1 i$ q有时候回传 1 笔,有时回传 3 笔,是不固定的
* x# I- U$ J; c6 y. L. m回头查语法定义
# Q0 {' d4 a; `5 o7 q1 X. lwith
5 ~: R- l7 A' E, B! Cagentset with [reporter]; E* W6 k# C# @2 K/ V- R- U! |
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.
7 X8 j" H0 n5 Q, ~它只说回传 agents satisfying the given condition$ G/ z+ X1 Y+ y# P7 u z a
是否 with 回传的是『符合条件』的数据,而不是『所有符合条件』的数据 ?
( Z; e9 h3 \/ [' a+ }' g/ A8 \, Y: g6 c4 q5 B& \+ R( _
想确定一下
" s) p, g+ p9 v, _7 z谢谢!3 Y0 C: d8 `+ N
|
|