|
|
新手发问超简单问题,目前还处于研读范例码的阶段,边测边看结果来理解程序6 Q" M) a% g2 J. |. a+ f: I
其中有一段如下
5 A- y6 M, d+ Y& x- Eask turtles with [ infected? = true ] + Z3 p/ d3 b1 q7 P# m
我原本以为这句会回传『所有』infected? = true 的 turtle" @' g5 l ~9 q E' Y4 B
但看结果似乎不是这样。
, ^1 {0 B8 |* P* N9 p1 w9 _" B/ Q% t2 K: x( ~) p
假设所有符合条件的有 5 笔7 G, l1 o1 r) v1 d: l! `
有时候回传 1 笔,有时回传 3 笔,是不固定的
3 T3 o. @3 @' {* @: u回头查语法定义
7 R/ \2 o' w% s) W, Zwith & {9 m$ t- b& v" x7 O
agentset with [reporter]
% I) P% X( q" m; wTakes 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.
4 l3 I) ~ j3 O9 M) \0 h" m它只说回传 agents satisfying the given condition
% [0 { d0 W( p- s+ o# g) g( F是否 with 回传的是『符合条件』的数据,而不是『所有符合条件』的数据 ?
# S5 J0 j9 \0 }+ Q
4 Z( M; l$ J, S1 G9 d* k' E2 m想确定一下
9 R5 S6 ?) S2 f7 w5 R2 p谢谢!
7 C# J8 ?: v& b0 i |
|