|
|
新手发问超简单问题,目前还处于研读范例码的阶段,边测边看结果来理解程序8 h$ k! M4 k, a, [- B" U
其中有一段如下
' f" U8 V* I2 _& E8 B' Dask turtles with [ infected? = true ]
) F: _- _" L0 E) v我原本以为这句会回传『所有』infected? = true 的 turtle
& X" V9 d) ~! p6 f但看结果似乎不是这样。3 G6 w0 _, O& }# X1 P
6 z2 A9 z& Y H z# d9 d( c; E8 c假设所有符合条件的有 5 笔( k- @8 U9 s+ ]
有时候回传 1 笔,有时回传 3 笔,是不固定的 x3 u9 n* P: l
回头查语法定义4 D4 k6 h7 I8 A2 T- _* m2 v& \. C
with
; c/ ^1 Q, x5 Z& yagentset with [reporter]$ u8 i# h9 q9 ]2 V/ d* 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.: P; D; K/ H' J9 n3 M! R
它只说回传 agents satisfying the given condition
# s5 p7 Y2 m1 Y/ A$ Y2 j) b' [( k }是否 with 回传的是『符合条件』的数据,而不是『所有符合条件』的数据 ? 1 I! r, t e7 I* W) G9 b+ H
! M" _$ \% K: z A! v想确定一下
& \! ?/ C5 D, Q' S7 @6 ?% t谢谢!! S# Q e! a: x7 z
|
|