|
|
新手发问超简单问题,目前还处于研读范例码的阶段,边测边看结果来理解程序
# C2 v4 K: {( f其中有一段如下
# L$ n4 j" [# Jask turtles with [ infected? = true ]
9 f; `! @! D* s) Y我原本以为这句会回传『所有』infected? = true 的 turtle
: C' X- {6 l' @. I& Z2 w但看结果似乎不是这样。8 _- w! K0 Z9 J9 C
# }7 I6 P1 i3 e ~9 h0 }& N0 N, b+ p假设所有符合条件的有 5 笔7 K- E( E0 J6 Z
有时候回传 1 笔,有时回传 3 笔,是不固定的
: }$ ]* W K# d7 T: h4 c回头查语法定义8 e8 t& `( L8 J* ^! }. P! w
with
' z( g; ]0 K- T p% K4 r7 sagentset with [reporter]
& s) O* v4 H" T( H* E1 mTakes 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 H5 U0 Y. S6 r$ G
它只说回传 agents satisfying the given condition
9 y/ ~0 A `, p是否 with 回传的是『符合条件』的数据,而不是『所有符合条件』的数据 ? W" J. L" W- K9 i% F* E$ p
/ |* b* A' R5 T; I S
想确定一下
6 e. ?1 V% V1 l! l' x4 P谢谢!
6 p5 e8 ^, n- B1 q1 F5 V) g |
|