|
|
新手发问超简单问题,目前还处于研读范例码的阶段,边测边看结果来理解程序( v: o8 I% B; }! I% e
其中有一段如下
' T |% y1 h( b2 j' V3 f3 g0 fask turtles with [ infected? = true ]
3 r9 a$ T: `9 {我原本以为这句会回传『所有』infected? = true 的 turtle: ^: s9 B' ]7 d
但看结果似乎不是这样。/ {, x& t/ ^2 q9 O. n! K& V
- z. v. I3 v- ^" t% F# K" g假设所有符合条件的有 5 笔
9 y2 Q9 a/ y& v8 p5 f8 H# }3 v5 j有时候回传 1 笔,有时回传 3 笔,是不固定的
/ s) l/ n' X% d6 X+ p回头查语法定义8 {7 m+ o4 s4 S5 Z: c7 V
with 6 a$ F' E0 I4 _% ^4 Q
agentset with [reporter]. y; A# K: k4 ^2 i
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.
( X4 |7 ?3 w0 y* X" M( b6 V它只说回传 agents satisfying the given condition
! j+ P. u/ b( L. F& M) l是否 with 回传的是『符合条件』的数据,而不是『所有符合条件』的数据 ?
/ i% M5 o( e6 O6 z" o! [
( ^5 O7 R( I: d7 v" p; O想确定一下9 Y$ ~6 O4 i. D" C' _, A
谢谢!7 k7 V% S9 B2 j0 G$ i
|
|