|
|
新手发问超简单问题,目前还处于研读范例码的阶段,边测边看结果来理解程序. ^7 ]3 n6 _5 W( s) a- ]
其中有一段如下
0 |: K0 {1 h3 ?8 X6 o$ Uask turtles with [ infected? = true ] % L/ {9 `4 M' b! e5 B
我原本以为这句会回传『所有』infected? = true 的 turtle
+ s. l5 Z* |3 w* r& K但看结果似乎不是这样。
& K: j& f) I& b* }: E. r
; t& o8 G2 o. [* u假设所有符合条件的有 5 笔
; ~% g( g& z" a有时候回传 1 笔,有时回传 3 笔,是不固定的
& N% l/ x- q# C' M4 ~" E# G回头查语法定义
" o( J5 z: ?9 q' T9 m: Z4 b8 mwith
- r2 j% |) @* b+ d, m% aagentset with [reporter]$ S- g( s& ~" z% R/ P
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., O$ k! I+ E5 V1 L' r
它只说回传 agents satisfying the given condition% I+ _3 g- e, l- C( E" J
是否 with 回传的是『符合条件』的数据,而不是『所有符合条件』的数据 ?
3 E/ _$ Q. |1 h/ G* g7 B7 Q2 ~! V" j: Y+ E' _& c+ U: _, e+ x$ }
想确定一下: ^# ~8 e3 A0 i, ^; F- L+ ?7 j
谢谢!" V! H9 [6 R! e6 J8 y9 B5 X
|
|