|
新手发问超简单问题,目前还处于研读范例码的阶段,边测边看结果来理解程序
' X- O }2 }) I% e3 M- v. F, j其中有一段如下
! W* {3 w0 `" o0 P4 j7 i8 jask turtles with [ infected? = true ] ; C8 B3 L" g: y# h9 L, J# Q2 z
我原本以为这句会回传『所有』infected? = true 的 turtle# |- H0 `3 _" G) C8 I8 a; ~
但看结果似乎不是这样。4 i6 e! Q' }& {0 F r5 M* y
F/ j" d! ?, h: t' m5 K假设所有符合条件的有 5 笔
" H7 O3 g/ X! p' [5 j1 L; u有时候回传 1 笔,有时回传 3 笔,是不固定的: A8 ]" x0 Q2 m% Q1 E# b* t0 ~# o, `; D
回头查语法定义2 ]) u9 }3 W A* D( Q
with f% M7 w7 A) h1 O. M3 G5 O
agentset with [reporter]4 ^' r* P' `( o2 |# q7 J2 {
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.( W! i3 v4 ]! v' F4 T
它只说回传 agents satisfying the given condition
/ @1 F! I& G8 n; w2 p是否 with 回传的是『符合条件』的数据,而不是『所有符合条件』的数据 ?
1 `5 I: x5 z' N' P- z; Z4 X- O. g
4 a6 |4 i- N: z0 _1 h想确定一下
# [) v- ~% m; O& v _* i谢谢!
3 w" g. T' q" z1 t |
|