|
|
新手发问超简单问题,目前还处于研读范例码的阶段,边测边看结果来理解程序4 v1 T. C* n u! }6 z
其中有一段如下
- p) c8 C5 y/ ^ y3 d1 u+ E' Sask turtles with [ infected? = true ]
& w+ I3 g0 }/ X) }( _我原本以为这句会回传『所有』infected? = true 的 turtle- T- S: D1 J7 Z
但看结果似乎不是这样。- ] h7 f% ]9 v4 n& H1 g4 P
8 v; {" s6 l- T0 }6 m. n* y
假设所有符合条件的有 5 笔
; @; \! {: _1 F$ W有时候回传 1 笔,有时回传 3 笔,是不固定的
; E1 p3 d* z- ~; _8 I回头查语法定义
- s: W0 i0 F5 a6 r: ~* Vwith
5 R- l& ~5 H p eagentset with [reporter]
6 V; M, I' l3 M" V/ ^+ N* g' lTakes 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.
' S- D4 {# W2 I1 T9 S它只说回传 agents satisfying the given condition( R2 O* q8 w* j
是否 with 回传的是『符合条件』的数据,而不是『所有符合条件』的数据 ? % V' X {! I5 j5 q
0 [0 U9 Z" S d, Z7 c) f2 B
想确定一下5 `+ U; p9 K2 D, O% g0 D6 M
谢谢!4 q1 Q6 A0 v/ J' f+ w$ w
|
|