|
|
新手发问超简单问题,目前还处于研读范例码的阶段,边测边看结果来理解程序+ v$ \$ B9 L- U [* Q) }+ D
其中有一段如下
- P5 {" W8 E+ C7 c# M$ Y7 rask turtles with [ infected? = true ] ( f( ~) O' D& ]+ M, @
我原本以为这句会回传『所有』infected? = true 的 turtle* h6 Y; k0 ?( O# {
但看结果似乎不是这样。
3 L' R; L. t7 P4 p& g {
) x% C$ t/ D; i P" ?" i7 {假设所有符合条件的有 5 笔
1 }( O6 h- r; w% O7 O3 G5 P有时候回传 1 笔,有时回传 3 笔,是不固定的
( }, `4 N2 k& d' f回头查语法定义; ^) ?! p# q. u# r
with * v" \; n/ A& |" v# a
agentset with [reporter]# _3 {- V2 W, v7 F, Z! @
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.3 H8 p) n% T7 M' G9 \* q
它只说回传 agents satisfying the given condition
' K$ L; q9 k7 s ?7 j. L9 O是否 with 回传的是『符合条件』的数据,而不是『所有符合条件』的数据 ?
( j" F+ P9 [" d7 R" q k! y3 O' \
想确定一下7 e: [" r& ]: e* }! r
谢谢!+ U7 j' Y: H1 p* k
|
|