|
|
新手发问超简单问题,目前还处于研读范例码的阶段,边测边看结果来理解程序/ ?4 Q; a5 C2 g: K5 ~, j. I
其中有一段如下
+ C4 r5 S/ X/ k8 h; ?6 Gask turtles with [ infected? = true ]
2 V1 V( Z: a ^& Z# d7 c, y9 ^1 G我原本以为这句会回传『所有』infected? = true 的 turtle7 O* c1 X4 z7 E5 Z2 k
但看结果似乎不是这样。
# b- Z! c8 H3 M( d/ F
; B% O. c% U0 }: x% k假设所有符合条件的有 5 笔
, u/ W/ E2 q9 u% `& V有时候回传 1 笔,有时回传 3 笔,是不固定的, }) G" a# s3 M2 _+ w1 }( `
回头查语法定义; d9 |, `7 r$ Z, u
with - {0 |8 r- r1 w% v/ i' x
agentset with [reporter]! @8 v5 q, a7 l. G& K7 W% P
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.5 x7 U+ y! b4 A3 x7 Z& z
它只说回传 agents satisfying the given condition
3 f$ v# B, P3 \9 j0 n# W* h! E是否 with 回传的是『符合条件』的数据,而不是『所有符合条件』的数据 ?
- ~/ S, t7 S# B( o1 Z- M% @; O: @
想确定一下
+ t! N7 d. }1 c" m7 M谢谢!
: E4 M6 b. S- J; ~* d( q |
|