|
|
新手发问超简单问题,目前还处于研读范例码的阶段,边测边看结果来理解程序" I3 m) t) E: u v- ^
其中有一段如下
. r* ], E9 O( kask turtles with [ infected? = true ]
& A+ A6 g; m: u我原本以为这句会回传『所有』infected? = true 的 turtle
7 B, G7 @, M' {+ y1 Z但看结果似乎不是这样。% r- t; [3 x+ n6 r1 [2 m/ X
/ m# ]0 R" E5 m3 d假设所有符合条件的有 5 笔
, `' M6 A( \, U+ s有时候回传 1 笔,有时回传 3 笔,是不固定的
2 ^; H; V% s/ t' a, [回头查语法定义
( M" Q# r) y# K, x/ _" o9 W y0 kwith
- c4 B- W9 S0 k4 |- W {' b+ nagentset with [reporter]
0 t+ N: F) q+ ^5 h2 w& @) b0 ~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.6 @ g9 x* M! p/ d$ c( R
它只说回传 agents satisfying the given condition
( W' a- Q' J5 v, ~是否 with 回传的是『符合条件』的数据,而不是『所有符合条件』的数据 ? / W+ N( I0 H9 d, i) G
0 q3 ^" X! R7 _" h Q8 D想确定一下
5 |$ |( b8 ^+ ^3 P( m& O" s谢谢!
5 ]% @* z- d( C. E c% F0 {& W; l |
|