|
|
新手发问超简单问题,目前还处于研读范例码的阶段,边测边看结果来理解程序( m3 S" F3 N0 ~, w( t4 v
其中有一段如下
; u# I6 ^" J K& X+ R+ Y, L$ m3 task turtles with [ infected? = true ]
: u* S. n* C T2 `8 J3 g$ Y我原本以为这句会回传『所有』infected? = true 的 turtle
# t' w1 H; b2 Z& z0 n但看结果似乎不是这样。
+ s1 V8 u2 q' V d% i0 O- {9 v" \( Z4 W q; g( g
假设所有符合条件的有 5 笔
: Z7 @' t2 U2 j- O S有时候回传 1 笔,有时回传 3 笔,是不固定的" L+ _0 {; _( b) ?1 n) ?
回头查语法定义% M% p6 X) }) A3 A) i! e) f
with
; O; N- G5 e( F& Z( Oagentset with [reporter]: f, _' ^+ D% |# x* {5 P7 I
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.; O# d$ r4 c7 D0 k2 w4 K9 U
它只说回传 agents satisfying the given condition1 f9 v8 v$ Y; a8 V
是否 with 回传的是『符合条件』的数据,而不是『所有符合条件』的数据 ?
, l6 R. C4 G+ |. t, M2 n+ g) X; b1 B+ }
& O, D1 c, J3 \$ C' }/ v想确定一下
& i" b8 q5 a0 e T谢谢!
/ P, K( n- y# y& `8 y( h |
|