|
|
新手发问超简单问题,目前还处于研读范例码的阶段,边测边看结果来理解程序
" [. D; T" J( A' `# |其中有一段如下
9 {7 N2 I. B. B+ R- K+ wask turtles with [ infected? = true ]
: M0 G, s- Z- l) b6 H% @我原本以为这句会回传『所有』infected? = true 的 turtle
" U) d% q/ R2 x% ?4 Z! o, w. S但看结果似乎不是这样。9 K/ `9 p! H' N3 o" Q5 d
6 ?; i7 W) v3 n3 b
假设所有符合条件的有 5 笔
- _) v0 L$ R5 ^) ~$ E, t有时候回传 1 笔,有时回传 3 笔,是不固定的" W' `' S* l+ I2 x# c
回头查语法定义8 v4 y, c) m6 M6 Y9 y+ \; [% v$ P
with
2 g, N, F4 L4 ^: _1 V) K: K8 Aagentset with [reporter]; t! d8 a# [8 r" E: d2 G' y( \% v
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.5 W! I: I2 I" E
它只说回传 agents satisfying the given condition4 L3 c7 Q0 v/ B: E8 V
是否 with 回传的是『符合条件』的数据,而不是『所有符合条件』的数据 ?
8 b; v/ ^9 ]5 V U M
+ p* ` ~9 [& H1 i& I9 V) H想确定一下/ B2 w" g8 q& p
谢谢!7 y- G( C* t9 W; p& v6 p/ L
|
|