|
|
新手发问超简单问题,目前还处于研读范例码的阶段,边测边看结果来理解程序
, t+ a, E) `1 K其中有一段如下
6 ]. ~3 N/ K( Jask turtles with [ infected? = true ] 8 C+ A3 m+ D m0 Q/ A! [
我原本以为这句会回传『所有』infected? = true 的 turtle0 ~0 _ e7 |- p
但看结果似乎不是这样。
$ P% C1 ?7 L; D1 D' ?& U ~, @
假设所有符合条件的有 5 笔
: g: h" z/ F2 z8 q1 K有时候回传 1 笔,有时回传 3 笔,是不固定的' r: x& \% X6 v
回头查语法定义( g. |9 J& [, Q) ^! y1 p* B
with
; j. s; Q. d+ j* x, Sagentset with [reporter]3 P& h4 y8 M$ F0 D
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.! _, U- N8 c+ a# Y
它只说回传 agents satisfying the given condition
! u! e% O: V$ S) P- ~ w# d是否 with 回传的是『符合条件』的数据,而不是『所有符合条件』的数据 ?
) ^& }" ~9 w" d# p4 z
& u1 g9 i M. W0 q: q% z% [; P. K$ a想确定一下# s( u9 {% H7 s- ]! N
谢谢!
9 ]5 Z% y R. T/ _ |
|