|
|
新手发问超简单问题,目前还处于研读范例码的阶段,边测边看结果来理解程序
8 k2 J, g7 D/ E其中有一段如下
2 \+ S) K7 l0 G( g, ]6 Z6 Yask turtles with [ infected? = true ]
, G9 e2 l, {3 _: N; {% Q+ w( y我原本以为这句会回传『所有』infected? = true 的 turtle
* @# h# P' Z% {2 n0 y! Q: ~4 C但看结果似乎不是这样。
$ x0 d6 j& y" L# h2 h, T9 A
/ J4 W" l3 d" V9 f& b3 M7 _) w假设所有符合条件的有 5 笔
- K" `/ ?5 H+ ^. S q1 m% o' u& A有时候回传 1 笔,有时回传 3 笔,是不固定的7 Q ~9 k+ a; f4 Z( i9 z0 a
回头查语法定义
+ ~% K* |! i9 i5 d2 T3 Zwith . i( o; ?9 a3 ]
agentset with [reporter]: Y5 Z o6 a0 c. |
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& l, z" U7 {+ o1 [
它只说回传 agents satisfying the given condition7 A0 j f7 b( G h) i$ X
是否 with 回传的是『符合条件』的数据,而不是『所有符合条件』的数据 ?
- w, {; C( [* U* k2 ? [: K! U$ C+ T, [
想确定一下
# B4 K ?% @5 i& [6 _谢谢!
3 H- F1 k5 K4 _$ y+ L6 ~, k5 K |
|