|
|
新手发问超简单问题,目前还处于研读范例码的阶段,边测边看结果来理解程序7 J2 G/ r6 W. \: V+ w
其中有一段如下
1 L0 v& H1 k( U9 J* w) g/ p, iask turtles with [ infected? = true ] D7 n. Y( l1 ]1 Q( [
我原本以为这句会回传『所有』infected? = true 的 turtle, N/ g/ X( w2 e7 @: G# ?* @
但看结果似乎不是这样。+ y' ~, e4 }# i0 T# k# N1 @2 `
, \, g6 H. j9 H
假设所有符合条件的有 5 笔
, w( U) {. | b有时候回传 1 笔,有时回传 3 笔,是不固定的
2 W9 N$ i2 [, u( Y, U2 [( k8 Y回头查语法定义5 ?$ r- z% r5 O8 M
with
4 m; H _ {8 m$ y4 ^, Y5 |) iagentset with [reporter]
$ }1 U! X* A+ bTakes 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.
& L m# l+ l" ?2 m. G& }7 w- m i它只说回传 agents satisfying the given condition
. ]# v; [2 F8 z. K4 k v* s/ `是否 with 回传的是『符合条件』的数据,而不是『所有符合条件』的数据 ?
. L, j) W$ h/ o
; @: w6 z0 {- D, h想确定一下/ ~2 \( L% V: m
谢谢!5 q3 E* _; X; W8 j+ Y& W
|
|