|
|
新手发问超简单问题,目前还处于研读范例码的阶段,边测边看结果来理解程序: J1 |9 }/ n; S; w7 |3 ~
其中有一段如下
7 P# K C" y8 e) y9 Iask turtles with [ infected? = true ] % D2 ~/ B: I' \5 J* O( B% r
我原本以为这句会回传『所有』infected? = true 的 turtle$ P1 i1 e4 J$ ^% F
但看结果似乎不是这样。/ o$ d% V8 g# S0 Q# P3 g( G
% T$ [7 K) \7 [+ U, t! e/ ] h
假设所有符合条件的有 5 笔
* ^! O5 J- f x; O) R1 q4 P" u有时候回传 1 笔,有时回传 3 笔,是不固定的3 h) ~" B3 `" w. a! p) n/ i$ C
回头查语法定义% L" ^6 q1 L. L y% q
with % Z" G; J4 V; O7 A" d3 F
agentset with [reporter]
! S3 w) y/ y! D. K& T2 hTakes 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.) x/ [ s$ b" @* N5 Q' L
它只说回传 agents satisfying the given condition7 B' v+ n5 m) r7 L
是否 with 回传的是『符合条件』的数据,而不是『所有符合条件』的数据 ?
- Z; G/ A! E8 {; t: B# }
1 y) s/ @' ~0 u2 ^想确定一下
9 P5 ~3 Q- }' Y1 X" P谢谢!
5 `, Y4 n1 p4 x, v& e9 f( g Z |
|