|
|
新手发问超简单问题,目前还处于研读范例码的阶段,边测边看结果来理解程序
2 p6 C# n+ j: K, S其中有一段如下
9 E+ N& h5 T ~. ^; Q7 T( g F# q0 uask turtles with [ infected? = true ] 4 ^7 X1 d% k/ g6 Y6 T
我原本以为这句会回传『所有』infected? = true 的 turtle* k2 P% d5 X2 N' h
但看结果似乎不是这样。
& B" }% W: v5 W7 Q$ D& a& F' R; g2 g0 `+ v5 l
假设所有符合条件的有 5 笔' Z5 S2 {+ O/ q- s2 O
有时候回传 1 笔,有时回传 3 笔,是不固定的9 {/ I5 X- u W( a% [% B
回头查语法定义" S3 z; }3 _( ?, ]: q( A
with
+ y) z9 |' Y; f% X8 {* Bagentset with [reporter]* m9 ^1 z% N" V6 e+ D1 f
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.
! s% \9 `& V }2 F: _它只说回传 agents satisfying the given condition9 i6 {7 L2 `* `: @
是否 with 回传的是『符合条件』的数据,而不是『所有符合条件』的数据 ? . g0 W5 b8 w5 |- ^7 W
7 U$ F1 Z' D* ~6 |" y! {想确定一下
7 j& b N0 c+ a谢谢!, [" y( d* L: ~
|
|