|
|
新手发问超简单问题,目前还处于研读范例码的阶段,边测边看结果来理解程序9 v9 Y* H1 P) p8 O3 Q& S+ C# Z
其中有一段如下
% S! M& j3 C/ ]9 @ a4 y9 @ask turtles with [ infected? = true ] & m( o0 x- c, q0 w N
我原本以为这句会回传『所有』infected? = true 的 turtle' D+ y8 |/ a- x8 D$ _
但看结果似乎不是这样。7 C5 k# n6 }$ P6 n5 @
# X T* U( d( b0 x+ B
假设所有符合条件的有 5 笔
, j8 ]) `0 z8 T& H有时候回传 1 笔,有时回传 3 笔,是不固定的
2 i( ~" { g! S4 ?" d5 }回头查语法定义% y2 b: u: t# Q# A( t4 }
with
4 j5 B4 [9 M! G% `4 ragentset with [reporter]
' Q: F% N3 @* ?7 m" i( uTakes 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.
1 P$ D: E* F7 L V0 {5 [它只说回传 agents satisfying the given condition
+ r' f# i- ^. s4 _% n% ?$ V是否 with 回传的是『符合条件』的数据,而不是『所有符合条件』的数据 ? % o. l( I+ E% U$ H3 L/ M# @# K2 I
5 |4 D# T4 y5 K# N; G
想确定一下
! Y0 z& T3 A- C5 N谢谢!
; i/ P; l" `' p, U |
|