|
|
新手发问超简单问题,目前还处于研读范例码的阶段,边测边看结果来理解程序
+ j, V, }' n3 ~4 c6 X其中有一段如下
2 A5 S+ E! W- r1 C. Q* t) {' Rask turtles with [ infected? = true ]
' e7 N$ `0 @+ J( O8 ]我原本以为这句会回传『所有』infected? = true 的 turtle# [# z+ d9 ^9 z, h7 c0 M
但看结果似乎不是这样。
$ z |9 p2 i# ^ u1 g1 |# z# e d8 f4 K
假设所有符合条件的有 5 笔
6 N$ o7 r9 w+ ~& S! B3 P: V: J# I; t有时候回传 1 笔,有时回传 3 笔,是不固定的
, O/ X3 |9 ]) I# E回头查语法定义' n! }; S( G/ F& _3 ^% Y# H
with
4 P! m3 n1 v* m& {agentset with [reporter]
$ k5 k& B: h7 x% STakes 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.
2 p D+ E: X! ?. R M& [它只说回传 agents satisfying the given condition' W7 Q$ B2 }6 Y5 S( T
是否 with 回传的是『符合条件』的数据,而不是『所有符合条件』的数据 ? ) y) O9 Y6 I+ F0 `& c
4 [, @) f$ Y$ y% P4 I: v/ F* X想确定一下3 u N6 h3 ]/ P6 U
谢谢!5 y- u$ v' x- a% X
|
|