|
|
新手发问超简单问题,目前还处于研读范例码的阶段,边测边看结果来理解程序
# Y. ~, k9 B y) A/ W0 U其中有一段如下
% G q4 U5 t+ aask turtles with [ infected? = true ]
: {8 H/ d* ` u- M我原本以为这句会回传『所有』infected? = true 的 turtle
8 O9 Y$ ^. j9 m% _3 V但看结果似乎不是这样。) B9 [) o0 F/ y" h( D4 a+ r
0 R* H1 M( {: j- h; x( B假设所有符合条件的有 5 笔
7 H3 W4 `1 i0 ]3 ~4 |有时候回传 1 笔,有时回传 3 笔,是不固定的
% k2 G+ l ^5 @* w# c回头查语法定义
# N! y1 b) i8 Twith
* v" X! s+ n5 F4 g. e9 G9 V- eagentset with [reporter]: a" d7 p+ {0 k9 n6 }
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." \- G0 _5 S ^2 z5 } g6 p3 y
它只说回传 agents satisfying the given condition3 k7 z) N- C# R1 K0 c5 m/ ~
是否 with 回传的是『符合条件』的数据,而不是『所有符合条件』的数据 ?
+ Q y0 y1 Z3 x) U6 X
8 m& [) x; Y" v2 j; R8 u, V想确定一下6 n+ p# O4 U0 O$ N/ g
谢谢!! k# Z! U! L7 O
|
|