|
|
新手发问超简单问题,目前还处于研读范例码的阶段,边测边看结果来理解程序# s* ^" m! T6 l8 v6 |; p
其中有一段如下
{' Y0 h1 P% uask turtles with [ infected? = true ]
/ J$ n7 X' b3 Q" z1 h3 ~% E我原本以为这句会回传『所有』infected? = true 的 turtle
7 x8 W: Q; p% R4 b9 }但看结果似乎不是这样。; H2 ^3 q, `2 K8 S. a
# H$ l9 Y5 \3 h; ?$ y
假设所有符合条件的有 5 笔2 G. \3 t7 a4 u
有时候回传 1 笔,有时回传 3 笔,是不固定的
e- F9 o6 s7 e, s9 L回头查语法定义
1 r3 I4 e) r( n, d0 rwith 1 h& I. i! z! x' @7 ^) ~: D/ X8 K) b
agentset with [reporter]
; R+ p! f/ N! t& _6 F5 rTakes 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.
! ]2 ]2 s) n# K2 S `它只说回传 agents satisfying the given condition
+ r$ y) n& s* \3 K是否 with 回传的是『符合条件』的数据,而不是『所有符合条件』的数据 ? 0 Z8 b6 t4 l, \- A& z
. i8 p G7 P3 N7 n3 [想确定一下
- T d+ f" G" x4 M8 E谢谢!' R5 F D* h4 O4 y" C# ^
|
|