|
|
新手发问超简单问题,目前还处于研读范例码的阶段,边测边看结果来理解程序* j. f& Z, q. S& R; q" d3 ]
其中有一段如下
& J. l1 r* V# rask turtles with [ infected? = true ]
F+ u P/ c2 z: l9 H3 _0 w. v我原本以为这句会回传『所有』infected? = true 的 turtle
- @% a6 [4 S. }2 F0 m: s/ E但看结果似乎不是这样。4 ~( D1 k$ I1 z- S- i w, x
U) l0 u/ b7 j; F7 L假设所有符合条件的有 5 笔
' |2 o2 M+ t4 n/ k2 F有时候回传 1 笔,有时回传 3 笔,是不固定的8 y. C, p3 I; \1 m& I
回头查语法定义9 w z1 @$ C0 }# }, _
with
0 Z1 O e1 ^" G" t* C! |agentset with [reporter]" Q0 K. P) I! w# j, g4 t$ m$ V/ r' f
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." t. ?8 m, a% p9 @/ M' {
它只说回传 agents satisfying the given condition3 Y g6 }4 q/ C- p j
是否 with 回传的是『符合条件』的数据,而不是『所有符合条件』的数据 ?
# o0 B- N% r" g9 R; @
5 K( \1 O, a, e, N& J& w7 R" H想确定一下0 V( D( ]. [( r- T, T/ i' i
谢谢!
, t, U) ?7 ]5 n/ |; T. H# s |
|