|
|
新手发问超简单问题,目前还处于研读范例码的阶段,边测边看结果来理解程序
% }$ _9 O; m0 D `( M其中有一段如下5 S& R+ g, \* I: p$ V7 O
ask turtles with [ infected? = true ] 3 H: w, ^# X) z* V$ X
我原本以为这句会回传『所有』infected? = true 的 turtle
$ F' l/ @! M+ f! w4 w. ^但看结果似乎不是这样。
4 b: w5 |* i/ j) ^- y( C( Z
4 I4 s R6 R5 o1 A假设所有符合条件的有 5 笔! U/ s" b) r6 j; U. z9 y
有时候回传 1 笔,有时回传 3 笔,是不固定的
5 U* N) B, G+ T, ]1 @% I( ^回头查语法定义& ^$ n, b( U5 \7 z6 b6 D
with
9 G) }. Q8 U; h0 g4 Uagentset with [reporter]1 o8 Z/ Y9 S5 `! I) @; b0 k. w
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.6 t. Q7 w+ ]0 {7 i
它只说回传 agents satisfying the given condition
4 H9 u8 q7 @5 @% i9 X5 @是否 with 回传的是『符合条件』的数据,而不是『所有符合条件』的数据 ? ( G; g! t- i. ]8 b) Q5 @: b H3 {
- {4 m/ N" b% o' q; C. l想确定一下; \5 M! Y" q2 m5 l- I
谢谢!+ y! r% i; s; C* M5 ]. ^! E& E
|
|