|
|
新手发问超简单问题,目前还处于研读范例码的阶段,边测边看结果来理解程序3 L0 V0 c" ^1 O2 w- P
其中有一段如下
1 L x6 k3 X1 `* x7 Y- Jask turtles with [ infected? = true ]
& T* t. J* I* ~0 C6 ]4 W# a) i( R我原本以为这句会回传『所有』infected? = true 的 turtle, A- }: M' P6 S! |
但看结果似乎不是这样。) u; Y R4 U8 ?/ j1 d! h6 c
6 E- y4 e3 w. c; D1 T假设所有符合条件的有 5 笔. \+ H) m, j4 ?6 n/ b' h
有时候回传 1 笔,有时回传 3 笔,是不固定的
! m0 N. w; t2 I. J7 d( Y回头查语法定义- o9 ?3 r. F* m3 p& k* Z
with
5 P' ~5 O, ]7 Cagentset with [reporter]
! Z( z4 q3 j. C" S' N/ m% |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.
9 X7 J p: W- C3 D2 z* O. L它只说回传 agents satisfying the given condition) x8 f: @6 x+ ^6 p5 d+ x* k
是否 with 回传的是『符合条件』的数据,而不是『所有符合条件』的数据 ? % M" C( h# W* N3 N
5 \4 r9 e" G2 j* a想确定一下: ^2 t, M _) o& b9 F
谢谢!
8 R8 `: {+ Z* G, G& w3 a, x/ c |
|