|
|
新手发问超简单问题,目前还处于研读范例码的阶段,边测边看结果来理解程序
" E4 \3 S' L; Q& B4 F2 S N其中有一段如下
: U9 f! `/ o6 J5 Task turtles with [ infected? = true ] & C+ u. H$ _- I9 b
我原本以为这句会回传『所有』infected? = true 的 turtle
/ ^6 G5 m& i1 a3 W# d但看结果似乎不是这样。
9 o" e! `# g" {1 R$ W, m; I3 L6 F# N1 N. _
假设所有符合条件的有 5 笔4 k) ^! {2 P C3 Y" I
有时候回传 1 笔,有时回传 3 笔,是不固定的
/ `1 T: I$ ^5 `, d, S+ z回头查语法定义! y# z8 Q( i v% d
with / v) K* Y0 k6 q5 s) C1 N, }0 k, R
agentset with [reporter]
4 O/ }* I. J" F6 C/ y' uTakes 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.
' [! ~2 i! b% [! X, ?; K6 @它只说回传 agents satisfying the given condition
$ {% p& e1 p6 U# Z% w是否 with 回传的是『符合条件』的数据,而不是『所有符合条件』的数据 ?
* w6 R1 _) U6 c2 y6 z' F7 \& G. A R, a8 p4 w G
想确定一下
6 K6 x6 {* g( N% f, C% \1 M# v5 o谢谢!6 D# Q- b- M( s/ `
|
|