|
|
新手发问超简单问题,目前还处于研读范例码的阶段,边测边看结果来理解程序$ v: ]3 K7 V( B' E8 w* }
其中有一段如下
6 u S L! C: p$ X F) z; q5 L. nask turtles with [ infected? = true ] % G% ]% H# E; |4 T
我原本以为这句会回传『所有』infected? = true 的 turtle
. f+ w2 p T: ~8 P/ W但看结果似乎不是这样。+ s1 m$ I# O* I3 q& B
. e. r) {8 s$ D. l假设所有符合条件的有 5 笔
9 \. `% M- N1 W8 \( R6 Z有时候回传 1 笔,有时回传 3 笔,是不固定的
) j8 Y! A [. [: C; g# J回头查语法定义
7 m$ j# A5 C% E/ M7 fwith ' _& r1 Y, V* z
agentset with [reporter]4 U0 q! t" H" W: [% g
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 C4 g- d1 y [9 G
它只说回传 agents satisfying the given condition( P& J3 w# k- g
是否 with 回传的是『符合条件』的数据,而不是『所有符合条件』的数据 ? " s" N* @+ ?2 j4 R
% @1 `9 x3 k6 {0 R+ P3 A: u想确定一下. u- Y. z8 |$ ^
谢谢!+ l% t/ m1 V) a2 Y5 M
|
|