|
|
新手发问超简单问题,目前还处于研读范例码的阶段,边测边看结果来理解程序
3 V" w1 J1 w/ m# \其中有一段如下
0 Q' F9 U2 b( s4 `4 iask turtles with [ infected? = true ]
4 p; S& P" J- n- K: g我原本以为这句会回传『所有』infected? = true 的 turtle
3 S2 J7 F* j3 Z但看结果似乎不是这样。* ]4 @! L& G" {
5 w. H' K! e4 H2 A' l) E J4 y假设所有符合条件的有 5 笔/ X# W* t8 g3 ]1 V5 h' G( Z9 R
有时候回传 1 笔,有时回传 3 笔,是不固定的
N# |: r% ]" W; p7 g+ u% A& u" h回头查语法定义
- t. s, C% w+ O7 \ Hwith
H( M& p$ t+ _! Yagentset with [reporter]$ b- I7 m% n! u3 ?0 ~& b0 f% ^ z
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.
# ~7 [/ m4 E& p H- o, i; t. q它只说回传 agents satisfying the given condition& [3 q& |* L3 A, Q6 K# T( `: e
是否 with 回传的是『符合条件』的数据,而不是『所有符合条件』的数据 ? 0 p F3 G3 \) @; _7 I) ]; @
$ G/ z y& | j0 X% B. u
想确定一下. \4 M3 F0 i2 }* H6 I
谢谢!. Q4 x, o0 w+ P
|
|