|
|
新手发问超简单问题,目前还处于研读范例码的阶段,边测边看结果来理解程序
- ~* `2 O1 f8 I; x% x其中有一段如下
# [' y' K! ]% z' mask turtles with [ infected? = true ] ' D* Q% r$ J8 B
我原本以为这句会回传『所有』infected? = true 的 turtle
4 D3 M( k+ a: l+ M但看结果似乎不是这样。
" Q3 I% `7 d- q+ ^9 n8 n# `( y. U* i, d
" l% [- `6 T# K$ j# H* \' T+ Q假设所有符合条件的有 5 笔2 R! m) ~/ M f0 `( p
有时候回传 1 笔,有时回传 3 笔,是不固定的+ C* `: C6 n ]5 x
回头查语法定义3 s" n$ g( B2 o% x3 l
with
" b9 M7 \# {( xagentset with [reporter]
* G( E* ^+ N; B/ ~0 @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.
3 o1 w& b6 d1 k+ ]5 g它只说回传 agents satisfying the given condition
F$ D) L# m9 V& X是否 with 回传的是『符合条件』的数据,而不是『所有符合条件』的数据 ?
) r1 t/ q1 ?3 T8 B5 u. j3 v9 J6 a% U
想确定一下, W m1 ~, S' ?+ D. z1 T7 d$ L2 O
谢谢!
% T3 V) Q5 t3 D/ R5 }1 Q3 f; | |
|