|
|
新手发问超简单问题,目前还处于研读范例码的阶段,边测边看结果来理解程序! R: i7 y7 V. c2 W( r( D6 Q: S, Q
其中有一段如下
3 a& a7 Z" l5 L9 u4 l) R2 U! X, Yask turtles with [ infected? = true ] - J$ M0 a/ h# a
我原本以为这句会回传『所有』infected? = true 的 turtle
' K. J' E+ I' E- F5 k+ h7 x7 M但看结果似乎不是这样。: Q( Q* D* Z0 O' @, y6 j- E
/ d* Q: N) P. m假设所有符合条件的有 5 笔
6 ?, E3 J1 Q; j6 C G有时候回传 1 笔,有时回传 3 笔,是不固定的
G( {8 h) p8 p4 q7 P8 @回头查语法定义1 v$ D4 k5 a! W4 T' V3 k
with
& w; Q3 `: `/ c. W; Gagentset with [reporter]
& q3 M" l. V2 h+ l5 j2 s& aTakes 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.
$ h3 l6 N. w7 h- v% \; H5 D ^它只说回传 agents satisfying the given condition
0 A0 u' {4 C. W* I+ ]" p是否 with 回传的是『符合条件』的数据,而不是『所有符合条件』的数据 ?
" w; o% a) w" K) l( t% [7 S. V" n% S* E! q9 ]3 H
想确定一下
$ Q1 J# `( L; N/ L谢谢!
* W1 M! F9 \4 S3 V9 J; x, G |
|