|
|
新手发问超简单问题,目前还处于研读范例码的阶段,边测边看结果来理解程序3 V. L, Z8 P& `* x, a3 {8 i
其中有一段如下
7 X) K; Y/ D5 C5 ^- `5 K p0 uask turtles with [ infected? = true ]
7 i: {7 K2 l+ Q6 b; J! V$ H6 _我原本以为这句会回传『所有』infected? = true 的 turtle) V7 ~: H: a t! Y `
但看结果似乎不是这样。2 \! Z4 x( y# A; F
8 h" `9 E3 E5 m+ {- q
假设所有符合条件的有 5 笔
, @4 W& ~9 z, o- k有时候回传 1 笔,有时回传 3 笔,是不固定的
7 n! k8 ~& A. A回头查语法定义
- {) F: D4 K! d' Awith
8 [$ d' U. j# a# S1 p3 ^agentset with [reporter]
% `! I* T: W6 ^. jTakes 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.8 s$ e9 G& k4 @5 `; u! C; f5 e
它只说回传 agents satisfying the given condition& i0 E3 S# C- k: _+ J
是否 with 回传的是『符合条件』的数据,而不是『所有符合条件』的数据 ? ! O3 {# ?% Z8 v3 [* _/ B7 |
% ?1 P6 _4 y. q7 n, Q想确定一下, m* z, ~8 x9 \
谢谢!9 G" K+ J& M; ^" Q
|
|