|
|
新手发问超简单问题,目前还处于研读范例码的阶段,边测边看结果来理解程序0 ~* u3 ~% D; h
其中有一段如下
& d. l# o! t* V3 o) D! Dask turtles with [ infected? = true ] ) p. d2 q; {$ S' I. |/ t
我原本以为这句会回传『所有』infected? = true 的 turtle
8 X- {& ?" g4 ]但看结果似乎不是这样。
' Z x. U7 L7 G# Y+ ?4 P. O- r% X* ?+ o" O9 J' p3 o$ V. M1 S+ `
假设所有符合条件的有 5 笔+ x0 r' c% s0 j" j$ h
有时候回传 1 笔,有时回传 3 笔,是不固定的
( V) P) C3 c5 ?# { o/ Q回头查语法定义6 D) O: X: |8 q
with
$ `" Q# _3 c6 ]4 U" T' C3 A2 Zagentset with [reporter]" A7 o; i8 c: Q
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.8 U1 J' j0 B% B3 s. n' f6 `
它只说回传 agents satisfying the given condition
! X& A; E2 D; L$ E: w! ?是否 with 回传的是『符合条件』的数据,而不是『所有符合条件』的数据 ? 0 }. E0 x u2 x0 q6 N% u1 s. {, @
" i3 j3 ~$ M( f' D+ L+ R8 Z9 {: R想确定一下7 O. m2 b( a6 i0 k; G" o j
谢谢!
6 Z) e4 x5 M' g9 z |
|