|
|
新手发问超简单问题,目前还处于研读范例码的阶段,边测边看结果来理解程序4 T6 ]0 N% [: ]9 \" W1 d
其中有一段如下
/ U' k6 F5 ?$ `, M- W: M) Xask turtles with [ infected? = true ]
8 n; y* u& b$ }6 r) ~我原本以为这句会回传『所有』infected? = true 的 turtle
6 t5 o. H1 s4 h但看结果似乎不是这样。1 L' W z& E4 M; k( P+ g) V4 t9 w
- a1 a8 n" p% ^7 |& }假设所有符合条件的有 5 笔
8 v$ k! E: C! o. h* `有时候回传 1 笔,有时回传 3 笔,是不固定的
/ f. {- h! A1 }( i! {回头查语法定义" V3 i' Q4 b5 \+ s! ]1 F, ]1 M
with
& f9 y" Q6 h2 `/ ^agentset with [reporter]; }( B$ _% H9 s0 h. i9 b- s
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., A! P1 i% C8 k/ h
它只说回传 agents satisfying the given condition
9 y1 ?1 o# i. K! Y* c( Z% i/ M. _/ [是否 with 回传的是『符合条件』的数据,而不是『所有符合条件』的数据 ?
$ `) L' g w7 S7 A" Q0 C! ~5 o- f: b% Z n1 y1 ~, S: n
想确定一下
$ E! T, q' @. D( ^谢谢!- L2 g8 ?$ x8 F. K+ {' I+ U; C! L
|
|