|
|
新手发问超简单问题,目前还处于研读范例码的阶段,边测边看结果来理解程序
# v0 F+ n% V0 _3 q" L/ j其中有一段如下
3 _2 P5 N) M% M- \* dask turtles with [ infected? = true ]
, F; L0 f! @# [# F# x* u我原本以为这句会回传『所有』infected? = true 的 turtle2 f) S) l! p! }9 v1 @
但看结果似乎不是这样。 k. Q- o3 V6 V1 l5 T5 D
8 T& `& i; l8 `" P( n
假设所有符合条件的有 5 笔6 S4 }( K! y2 O; |' [& g
有时候回传 1 笔,有时回传 3 笔,是不固定的
$ [; v) ? S3 `; Z' @8 k Z6 M回头查语法定义0 D6 [ i2 \' T4 i( N
with
2 G7 ?. B) }9 f& u: f2 Sagentset with [reporter]
) \, Z$ X# b3 b! xTakes 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.* v, v$ R5 `2 j, Q0 a1 o6 ^
它只说回传 agents satisfying the given condition
. M) L0 z$ g& m) k# o5 X1 _是否 with 回传的是『符合条件』的数据,而不是『所有符合条件』的数据 ? 4 @6 d$ s5 p% K( ^% ~
" c0 l* _' e# E( Z @2 \4 \% K6 L3 q想确定一下 K+ H G4 C3 o7 o$ ?5 z9 M& p
谢谢!& Q& E- O8 ]# V J+ M7 {; r( z
|
|