|
|
新手发问超简单问题,目前还处于研读范例码的阶段,边测边看结果来理解程序 g$ C* r# x0 x/ |! ~
其中有一段如下
( \0 R4 t! y6 ~0 p1 F' F+ i3 Aask turtles with [ infected? = true ] " y! V- i5 B$ }" s+ H8 I5 h
我原本以为这句会回传『所有』infected? = true 的 turtle) G7 A& b$ G4 m+ S6 c5 N$ p. m
但看结果似乎不是这样。6 P. r. S1 U C
$ P- m$ R+ ~) H: M/ d假设所有符合条件的有 5 笔
: _0 C* P& m+ D3 C有时候回传 1 笔,有时回传 3 笔,是不固定的
. S, J2 L$ l! a% X( E7 P回头查语法定义- R# o: E' |& A0 g7 x' N% T
with
^% @" r1 q6 K2 `/ Lagentset with [reporter]
# v' [) F) v' a& n9 P+ ITakes 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.
+ C* Q/ h$ ^, F+ ?; V它只说回传 agents satisfying the given condition
h2 J. Y) b9 F+ }是否 with 回传的是『符合条件』的数据,而不是『所有符合条件』的数据 ? & u. t# L: n* |3 j
! p% L+ F7 `/ X4 r9 f& ]6 _) X5 s5 k
想确定一下8 V5 b |8 i- _# m1 J, F: `
谢谢!+ ]/ x! E+ z' z7 w' u U
|
|