|
|
新手发问超简单问题,目前还处于研读范例码的阶段,边测边看结果来理解程序# J) S6 M. g* e
其中有一段如下
3 ?5 z2 r2 k- V% I( N- r* E2 ~' d1 pask turtles with [ infected? = true ]
' R9 \" S9 d% e0 C我原本以为这句会回传『所有』infected? = true 的 turtle* l; a3 A: M: z
但看结果似乎不是这样。" D% ]4 n! G* ~7 i& f( G0 D. K, l
( w# t* c( |2 |# Y3 Z/ Y2 e
假设所有符合条件的有 5 笔
( i H# d0 E: g8 H. O8 [有时候回传 1 笔,有时回传 3 笔,是不固定的
4 q: T5 v$ w; z2 ]/ }回头查语法定义, `! c; ]" G* |+ C
with % E& Q2 N+ v8 B) U
agentset with [reporter]5 J4 S0 G# p( _, B- h
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.
$ t1 U+ C- `# t它只说回传 agents satisfying the given condition
8 K5 ^( f) W1 S$ i是否 with 回传的是『符合条件』的数据,而不是『所有符合条件』的数据 ? H1 H" V4 A0 ~/ l2 a3 C" C
& M: ~& G, w {) n9 s
想确定一下/ E; d8 C1 F. T$ b
谢谢!# c9 X" ]1 {: f( G
|
|