|
|
新手发问超简单问题,目前还处于研读范例码的阶段,边测边看结果来理解程序
$ j2 C0 r: v9 A, e0 n其中有一段如下
8 n/ g3 d+ i4 O/ k5 [9 w8 U9 u. Kask turtles with [ infected? = true ]
: R$ I9 Q; z4 y我原本以为这句会回传『所有』infected? = true 的 turtle2 w; I7 ]: h* s* |- O3 {+ k
但看结果似乎不是这样。" q+ k/ E* V! b8 b. r; K
: `- _7 B3 X4 m# _0 ?9 V5 P4 L
假设所有符合条件的有 5 笔7 q0 d$ ?+ j2 i: U2 F6 T' _
有时候回传 1 笔,有时回传 3 笔,是不固定的
% W+ K4 m! W# b2 q回头查语法定义- i/ x: w5 M4 B0 F8 m- j* ]
with
! c9 x+ P: _+ N6 W1 zagentset with [reporter]
' @4 u+ y, v. P: eTakes 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.
2 v8 P0 W5 F8 Y7 h4 u它只说回传 agents satisfying the given condition
) B: @7 t1 W# ?是否 with 回传的是『符合条件』的数据,而不是『所有符合条件』的数据 ? / h: D) X7 s, K# j- x' c
/ Y. f+ q/ `) k( }
想确定一下
! Y- G ]' R# I% j8 y4 ^' O& ?谢谢!/ A0 a2 T) a- p6 Z: Y% W; \& v d: e
|
|