|
|
新手发问超简单问题,目前还处于研读范例码的阶段,边测边看结果来理解程序
7 _9 G9 {) o/ h其中有一段如下
0 X! {% ^" ?. {% [' a" l0 Z: @ask turtles with [ infected? = true ]
. e7 V n$ `4 A( N5 D% m9 C& y8 r我原本以为这句会回传『所有』infected? = true 的 turtle- `6 ~) G/ v9 y
但看结果似乎不是这样。% I" Y7 k% g; g9 S
1 N: g) f# D5 u假设所有符合条件的有 5 笔
; ]8 O( W" B3 {$ L1 e6 O( z S+ V有时候回传 1 笔,有时回传 3 笔,是不固定的
t; |$ N- D# U) F回头查语法定义8 {" i$ x( S3 r8 z( a
with
0 T# U: P. o* l' P& ]6 x! Jagentset with [reporter]
/ b4 D, Y/ ]& {1 B4 m% H, HTakes 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.
: A, J7 _' y) D8 `& i它只说回传 agents satisfying the given condition9 U8 U3 T. [# l6 F/ h' x# d2 o
是否 with 回传的是『符合条件』的数据,而不是『所有符合条件』的数据 ?
u! `* ], m( G
) [: N1 ?! x6 p( Y5 h想确定一下* N3 @* }. w4 ^1 k }; A( R+ r
谢谢!* h( M- p3 O# |
|
|