|
|
新手发问超简单问题,目前还处于研读范例码的阶段,边测边看结果来理解程序8 o4 D; e/ J. Z0 I- O3 ~
其中有一段如下
+ x* q' _9 W& k) n0 ?ask turtles with [ infected? = true ] 5 E; O" n0 |1 X( V$ z" j8 I8 v+ }3 w
我原本以为这句会回传『所有』infected? = true 的 turtle4 X% d) \+ v# E; R6 S0 p
但看结果似乎不是这样。
4 q) p2 y5 W& O0 ]" U8 A% Z
; k4 e ]0 ?; [; U4 T1 p; h& d假设所有符合条件的有 5 笔
2 p) m- O. y/ `) r o有时候回传 1 笔,有时回传 3 笔,是不固定的+ \' S7 p3 y5 ~+ e1 I1 z6 F7 {8 ]
回头查语法定义7 e0 l# n2 I$ ^8 a
with
! D6 B7 S+ k X% @0 d# R, x2 oagentset with [reporter]
5 w9 V1 o/ _7 D6 i" l) u0 X2 b5 @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.1 k# o/ [# c% E" S# e* N; Q$ E
它只说回传 agents satisfying the given condition3 v9 p8 J0 B% S
是否 with 回传的是『符合条件』的数据,而不是『所有符合条件』的数据 ?
0 y/ k" }, ?2 \& i7 M* s
4 l8 z/ ^3 l) Q0 `. Y$ S7 ?想确定一下' m7 P& V& ?9 x4 u& [* c
谢谢!. g2 u* p2 T8 \" E+ l
|
|