|
|
新手发问超简单问题,目前还处于研读范例码的阶段,边测边看结果来理解程序7 Z# L3 ~, @6 a. _; H
其中有一段如下
" B8 {. a4 o1 i0 zask turtles with [ infected? = true ]
% Q; v1 [- n% Z+ v8 M J$ p我原本以为这句会回传『所有』infected? = true 的 turtle
4 U) ?; Z3 j h3 E. ~5 R& [但看结果似乎不是这样。
( i" s a& a" I- \) T! B: {( R& [& S" n V2 y" q+ N# S
假设所有符合条件的有 5 笔3 m {: p% C, w& k1 L
有时候回传 1 笔,有时回传 3 笔,是不固定的
- L0 C/ o, V; h y1 m, C( m回头查语法定义
' _( e! N' t, ^with
7 j- T3 d! Y2 C6 tagentset with [reporter]
, A- |% `. t/ z. g1 g, [1 @0 q8 pTakes 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.
( s" H. y: x$ B% i) j: J它只说回传 agents satisfying the given condition
2 m" B: x* d# n! p是否 with 回传的是『符合条件』的数据,而不是『所有符合条件』的数据 ? $ ?* C! R% f. V+ V% R- i' T5 M
5 j8 ]! P. K+ I# g9 a8 {# ]* |5 U: j想确定一下
9 D2 e5 j: j' m0 ^, Y7 O2 r6 W谢谢!
! T4 y1 Y9 Z" Z0 V |
|