|
|
新手发问超简单问题,目前还处于研读范例码的阶段,边测边看结果来理解程序+ X& V! Z0 F0 U8 k
其中有一段如下
" @) V! F9 D% p$ q- l2 Vask turtles with [ infected? = true ]
3 ]3 H( f8 C; [我原本以为这句会回传『所有』infected? = true 的 turtle
6 B0 S4 G! f7 k7 v但看结果似乎不是这样。
9 I/ `" I8 ?( \4 {$ T( r2 E1 f7 l' m0 z
假设所有符合条件的有 5 笔' q# V( O4 \- q% V; `+ t3 K e
有时候回传 1 笔,有时回传 3 笔,是不固定的
# D8 S* L& W) z0 _% ?. j回头查语法定义
( p& ? Q- M7 B& ^2 L, V- Awith l& \( \+ H; |/ n |# d4 {* s
agentset with [reporter]
3 E) A$ { I3 N' J% [. j- \4 KTakes 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 c) w) F2 K. Z) n. b! z- n# G1 D
它只说回传 agents satisfying the given condition" X# V K0 @# u# Z
是否 with 回传的是『符合条件』的数据,而不是『所有符合条件』的数据 ? # f: A+ ], x. i+ a& n1 l
3 D7 S8 d \2 g& x/ t% J3 d- T
想确定一下
: X( w( F. Q/ h4 Y0 a0 B8 G谢谢!
, ^+ f& A# Q" J: v) ^& H/ o$ T |
|