|
|
新手发问超简单问题,目前还处于研读范例码的阶段,边测边看结果来理解程序% r9 F* k. [; b9 @! B
其中有一段如下
. W# p' M6 r$ Q3 K% ]' W# ]% F4 Bask turtles with [ infected? = true ] % k1 c, |# f( `- j7 v
我原本以为这句会回传『所有』infected? = true 的 turtle
$ o& _2 ~6 y, _- U1 y$ \但看结果似乎不是这样。
. P8 s) @' D5 y) p/ o% T' Y S' p) s F! x
假设所有符合条件的有 5 笔# Y; n. X/ R& y8 G- S6 I) j& _# E
有时候回传 1 笔,有时回传 3 笔,是不固定的
) J$ `1 C7 y3 y4 M. N8 e回头查语法定义
# ^, D# \9 g/ U# y$ {. u8 |with
9 P1 i3 `( O+ B# jagentset with [reporter]
" E G5 C& \9 D6 Z- 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.* v; E Q+ S: t+ f( T& j
它只说回传 agents satisfying the given condition2 \4 {3 j/ ^! D$ V( V
是否 with 回传的是『符合条件』的数据,而不是『所有符合条件』的数据 ?
9 I9 k7 \# d1 F p/ w3 {. ^$ D* j6 _/ e7 J! Y6 s
想确定一下
# J* [9 X T( v L谢谢!
9 s/ J. g2 u3 J6 m |
|