|
|
新手发问超简单问题,目前还处于研读范例码的阶段,边测边看结果来理解程序2 s/ z( I& T/ W0 ^. s
其中有一段如下
D( {. Q$ j9 ?/ p0 B6 y) gask turtles with [ infected? = true ] " U' P0 k: \" k [# {0 m
我原本以为这句会回传『所有』infected? = true 的 turtle/ d5 ?7 Y. W! |. {' d
但看结果似乎不是这样。! O0 g" I$ L% l y
+ M' u3 _' W- t( O% G& K7 X
假设所有符合条件的有 5 笔
+ Q/ j% p/ p! m* T3 V有时候回传 1 笔,有时回传 3 笔,是不固定的3 c! ~( j4 e9 u! J! H
回头查语法定义 `; d0 [; f% g* T
with
3 \; P' [; Z- yagentset with [reporter]
7 z7 x6 g" x8 ]+ GTakes 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 |- o. Q$ X' D& b' }它只说回传 agents satisfying the given condition# {8 C* i" K! \( Z
是否 with 回传的是『符合条件』的数据,而不是『所有符合条件』的数据 ?
0 d) q2 `# [3 z, u& B' s
6 g" s. A' z8 U1 J9 R想确定一下, D0 |5 r i5 {/ ` W- ]
谢谢!
$ V/ C, n. I- @4 e |
|