|
|
新手发问超简单问题,目前还处于研读范例码的阶段,边测边看结果来理解程序
3 a9 [# d* }: f# m( B4 i" p其中有一段如下
/ E$ u& s% u4 C( O6 ~. Jask turtles with [ infected? = true ]
6 y& N- ] A$ x我原本以为这句会回传『所有』infected? = true 的 turtle
: v2 t. u1 s- O* I" i但看结果似乎不是这样。
; i+ i& Z8 Y9 `- y# Z
# ]4 a- F' Z1 n( t& D& Z& N假设所有符合条件的有 5 笔5 {3 V4 T* d4 h6 D# x9 M9 A1 {
有时候回传 1 笔,有时回传 3 笔,是不固定的
8 {. W4 x% `- I5 H a8 H回头查语法定义& X3 e7 U4 S6 W; d$ J4 ]
with
+ h" {8 h+ C! I/ X0 R. w) Oagentset with [reporter]/ ^; K8 Y" }8 t( k
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.* K) V7 _% P: }2 J8 ^
它只说回传 agents satisfying the given condition
- d! q% ` P7 q+ }! ^/ N( S是否 with 回传的是『符合条件』的数据,而不是『所有符合条件』的数据 ? ) W2 G* `) J. V4 E# g2 t( h
1 @: q S1 W" E6 ~; ?想确定一下- q! ~- q0 y9 q0 J$ E5 a6 p
谢谢!$ r( u$ p" }5 O6 D; j0 M/ X; h
|
|